Skip to content

Commit

Permalink
๐ŸŽจ Style: Format
Browse files Browse the repository at this point in the history
  • Loading branch information
Zerohertz committed Jul 8, 2023
1 parent 86c0023 commit ec825d8
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 23 deletions.
4 changes: 2 additions & 2 deletions BOJ/Gold/1053/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

def swap(s, idx1, idx2):
tmp = s[idx2]
s = s[:idx2] + s[idx1] + s[idx2 + 1 :]
s = s[:idx1] + tmp + s[idx1 + 1 :]
s = s[:idx2] + s[idx1] + s[idx2 + 1:]
s = s[:idx1] + tmp + s[idx1 + 1:]
return s


Expand Down
3 changes: 2 additions & 1 deletion BOJ/Gold/12851/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def BFS(pos):
while q:
tmp, t = q.popleft()
for i in [tmp - 1, tmp + 1, tmp * 2]:
if 0 <= i <= 100_000 and (visit[i][0] == -1 or visit[i][0] == t + 1):
if 0 <= i <= 100_000 and (
visit[i][0] == -1 or visit[i][0] == t + 1):
if visit[i][0] == t + 1:
visit[i][1] += visit[tmp][1]
else:
Expand Down
2 changes: 1 addition & 1 deletion BOJ/Gold/12865/Legacy/ver1.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
tmpb = tmpbin[2:]
binidx = [tmpb[j] for j in range(len(tmpb))]
idx = ["0" for j in range(N)]
idx[N - len(binidx) :] = binidx
idx[N - len(binidx):] = binidx
totW = 0
totV = 0
for j in range(N):
Expand Down
3 changes: 2 additions & 1 deletion BOJ/Gold/13459/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def gravity(tmppos, direction):
v1, v2 = dirdict[direction]
RedGoalIn = False
while True:
if l[rx + v1][ry + v2] != "#" or l[bx + v1][by + v2] != "#": # ๋‘˜ ์ค‘ ํ•˜๋‚˜๊ฐ€ ์ด๋™ ๊ฐ€๋Šฅํ•  ๋•Œ
if l[rx + v1][ry + v2] != "#" or l[bx +
v1][by + v2] != "#": # ๋‘˜ ์ค‘ ํ•˜๋‚˜๊ฐ€ ์ด๋™ ๊ฐ€๋Šฅํ•  ๋•Œ
if l[rx + v1][ry + v2] != "#" and not RedGoalIn: # Red ์ด๋™
rx += v1
ry += v2
Expand Down
3 changes: 2 additions & 1 deletion BOJ/Gold/13460/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def gravity(tmppos, direction):
v1, v2 = dirdict[direction]
RedGoalIn = False
while True:
if l[rx + v1][ry + v2] != "#" or l[bx + v1][by + v2] != "#": # ๋‘˜ ์ค‘ ํ•˜๋‚˜๊ฐ€ ์ด๋™ ๊ฐ€๋Šฅํ•  ๋•Œ
if l[rx + v1][ry + v2] != "#" or l[bx +
v1][by + v2] != "#": # ๋‘˜ ์ค‘ ํ•˜๋‚˜๊ฐ€ ์ด๋™ ๊ฐ€๋Šฅํ•  ๋•Œ
if l[rx + v1][ry + v2] != "#" and not RedGoalIn: # Red ์ด๋™
rx += v1
ry += v2
Expand Down
3 changes: 2 additions & 1 deletion BOJ/Gold/2174/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def goForward(robotNo, cnt):
break
if G[nx][ny][0] != 0:
print(
"Robot " + str(robotNo + 1) + " crashes into robot " + str(G[nx][ny][0])
"Robot " + str(robotNo + 1) +
" crashes into robot " + str(G[nx][ny][0])
)
status = False
break
Expand Down
3 changes: 2 additions & 1 deletion BOJ/Gold/3109/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def DFS(i, j):
if j == C - 1:
return True
for v in vec:
if 0 <= i + v < R and l[i + v][j + 1] == "." and not visit[i + v][j + 1]:
if 0 <= i + v < R and l[i + v][j +
1] == "." and not visit[i + v][j + 1]:
visit[i + v][j + 1] = True
if DFS(i + v, j + 1):
return True
Expand Down
3 changes: 2 additions & 1 deletion BOJ/Gold/3190/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
dir_x, dir_y = 1, 0
time = 0

rightTurn = {(1, 0): (0, 1), (0, 1): (-1, 0), (-1, 0): (0, -1), (0, -1): (1, 0)}
rightTurn = {(1, 0): (0, 1), (0, 1): (-1, 0),
(-1, 0): (0, -1), (0, -1): (1, 0)}
leftTurn = {(1, 0): (0, -1), (0, -1): (-1, 0), (-1, 0): (0, 1), (0, 1): (1, 0)}

while True:
Expand Down
6 changes: 4 additions & 2 deletions BOJ/Gold/9328/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def BFS(x, y):
q.append((nx, ny))
elif l[nx][ny].islower():
door[ord(l[nx][ny]) - ord("a")] = True
visit = [[False for _ in range(w + 2)] for _ in range(h + 2)]
visit = [[False for _ in range(w + 2)]
for _ in range(h + 2)]
l[nx][ny] = "."
q.append((nx, ny))
elif l[nx][ny].isupper():
Expand Down Expand Up @@ -50,7 +51,8 @@ def BFS(x, y):
door[ord(key) - ord("a")] = True
for i in range(h):
for j in range(w):
if ord("A") <= ord(l[i][j]) <= ord("Z") and door[ord(l[i][j]) - ord("A")]:
if ord("A") <= ord(l[i][j]) <= ord(
"Z") and door[ord(l[i][j]) - ord("A")]:
l[i][j] = "."
for i in l:
i.insert(0, ".")
Expand Down
2 changes: 1 addition & 1 deletion BOJ/Gold/9466/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def DFS(pos):
tmp.append(pos)
if visit[l[pos]]:
if l[pos] in tmp:
res += tmp[tmp.index(l[pos]) :]
res += tmp[tmp.index(l[pos]):]
return
else:
DFS(l[pos])
Expand Down
8 changes: 4 additions & 4 deletions BOJ/Gold/9553/Legacy/ver1.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ def returnAvg(x1, y1, x2, y2, angleHitList):

for i in range(T):
angleHitList = [0 for i in range(36001)]
tmpx1 = x1[N[i - 1] * (i) : N[i] * (i + 1)]
tmpy1 = y1[N[i - 1] * (i) : N[i] * (i + 1)]
tmpx2 = x2[N[i - 1] * (i) : N[i] * (i + 1)]
tmpy2 = y2[N[i - 1] * (i) : N[i] * (i + 1)]
tmpx1 = x1[N[i - 1] * (i): N[i] * (i + 1)]
tmpy1 = y1[N[i - 1] * (i): N[i] * (i + 1)]
tmpx2 = x2[N[i - 1] * (i): N[i] * (i + 1)]
tmpy2 = y2[N[i - 1] * (i): N[i] * (i + 1)]
avg.append(returnAvg(tmpx1, tmpy1, tmpx2, tmpy2, angleHitList))

for i in range(T):
Expand Down
3 changes: 2 additions & 1 deletion BOJ/Platinum/15807/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

for y in range(1, 3002):
for x in range(1, 3002):
axis[x][y] = diag1[3002 + x - y] + axis[x][y - 1] + diag2[x + y] + light[x][y]
axis[x][y] = diag1[3002 + x - y] + \
axis[x][y - 1] + diag2[x + y] + light[x][y]
diag1[3002 + x - y] += light[x][y]
diag2[x + y] += light[x][y]

Expand Down
3 changes: 2 additions & 1 deletion BOJ/Silver/1010/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@

for i in range(T):
print(
int(math.factorial(M[i]) / (math.factorial(M[i] - N[i]) * math.factorial(N[i])))
int(math.factorial(M[i]) /
(math.factorial(M[i] - N[i]) * math.factorial(N[i])))
)
2 changes: 1 addition & 1 deletion BOJ/Silver/11399/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

res = 0
for i in range(N):
res += sum(l[0 : i + 1])
res += sum(l[0: i + 1])

print(res)
3 changes: 2 additions & 1 deletion BOJ/Silver/11660/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

for i in range(N):
for j in range(N):
dp[i + 1][j + 1] = l[i + 1][j + 1] + dp[i + 1][j] + dp[i][j + 1] - dp[i][j]
dp[i + 1][j + 1] = l[i + 1][j + 1] + \
dp[i + 1][j] + dp[i][j + 1] - dp[i][j]

for _ in range(M):
x1, y1, x2, y2 = map(int, read().split())
Expand Down
2 changes: 1 addition & 1 deletion BOJ/Silver/1543/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
tmp = 0

while tmp <= len(s1) - len(s2):
if s1[tmp : tmp + len(s2)] == s2:
if s1[tmp: tmp + len(s2)] == s2:
cnt += 1
tmp += len(s2)
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def match(
):
for i in range(M):
for j in range(M):
ni, nj = convert_func(rot, s1, s2, idx_i_1, idx_j_1, idx_i_2, idx_j_2, i, j)
ni, nj = convert_func(
rot, s1, s2, idx_i_1, idx_j_1, idx_i_2, idx_j_2, i, j)
if (0 <= ni < N) and (0 <= nj < N):
if (idx_i_1 <= ni <= idx_i_2) and (idx_j_1 <= nj <= idx_j_2):
if key[i][j] == lock[ni][nj]:
Expand Down
2 changes: 1 addition & 1 deletion Programmers/Sort/K๋ฒˆ์งธ์ˆ˜/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
def solution(array, commands):
answer = []
for command in commands:
tmparr = sorted(array[command[0] - 1 : command[1]])
tmparr = sorted(array[command[0] - 1: command[1]])
answer.append(tmparr[command[2] - 1])
return answer

0 comments on commit ec825d8

Please sign in to comment.