diff --git a/BOJ/Gold/1053/main.py b/BOJ/Gold/1053/main.py index d213dab..e5d88b3 100644 --- a/BOJ/Gold/1053/main.py +++ b/BOJ/Gold/1053/main.py @@ -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 diff --git a/BOJ/Gold/12851/main.py b/BOJ/Gold/12851/main.py index e03f273..cc552dc 100644 --- a/BOJ/Gold/12851/main.py +++ b/BOJ/Gold/12851/main.py @@ -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: diff --git a/BOJ/Gold/12865/Legacy/ver1.py b/BOJ/Gold/12865/Legacy/ver1.py index 8da28f1..e413883 100644 --- a/BOJ/Gold/12865/Legacy/ver1.py +++ b/BOJ/Gold/12865/Legacy/ver1.py @@ -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): diff --git a/BOJ/Gold/13459/main.py b/BOJ/Gold/13459/main.py index f9ffb63..972d452 100644 --- a/BOJ/Gold/13459/main.py +++ b/BOJ/Gold/13459/main.py @@ -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 diff --git a/BOJ/Gold/13460/main.py b/BOJ/Gold/13460/main.py index 50724a4..4c319bf 100644 --- a/BOJ/Gold/13460/main.py +++ b/BOJ/Gold/13460/main.py @@ -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 diff --git a/BOJ/Gold/2174/main.py b/BOJ/Gold/2174/main.py index 9af1d9e..7106f4d 100644 --- a/BOJ/Gold/2174/main.py +++ b/BOJ/Gold/2174/main.py @@ -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 diff --git a/BOJ/Gold/3109/main.py b/BOJ/Gold/3109/main.py index d0e0d7e..cb4add2 100644 --- a/BOJ/Gold/3109/main.py +++ b/BOJ/Gold/3109/main.py @@ -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 diff --git a/BOJ/Gold/3190/main.py b/BOJ/Gold/3190/main.py index 279e5d5..46ceb9f 100644 --- a/BOJ/Gold/3190/main.py +++ b/BOJ/Gold/3190/main.py @@ -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: diff --git a/BOJ/Gold/9328/main.py b/BOJ/Gold/9328/main.py index 7815fff..b5ae31c 100644 --- a/BOJ/Gold/9328/main.py +++ b/BOJ/Gold/9328/main.py @@ -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(): @@ -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, ".") diff --git a/BOJ/Gold/9466/main.py b/BOJ/Gold/9466/main.py index a869afc..30e38f2 100644 --- a/BOJ/Gold/9466/main.py +++ b/BOJ/Gold/9466/main.py @@ -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]) diff --git a/BOJ/Gold/9553/Legacy/ver1.py b/BOJ/Gold/9553/Legacy/ver1.py index 0a155dd..7093165 100644 --- a/BOJ/Gold/9553/Legacy/ver1.py +++ b/BOJ/Gold/9553/Legacy/ver1.py @@ -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): diff --git a/BOJ/Platinum/15807/main.py b/BOJ/Platinum/15807/main.py index 83e74ad..3bcb56c 100644 --- a/BOJ/Platinum/15807/main.py +++ b/BOJ/Platinum/15807/main.py @@ -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] diff --git a/BOJ/Silver/1010/main.py b/BOJ/Silver/1010/main.py index 6d04673..456eab7 100644 --- a/BOJ/Silver/1010/main.py +++ b/BOJ/Silver/1010/main.py @@ -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]))) ) diff --git a/BOJ/Silver/11399/main.py b/BOJ/Silver/11399/main.py index 0033f5e..e1ef249 100644 --- a/BOJ/Silver/11399/main.py +++ b/BOJ/Silver/11399/main.py @@ -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) diff --git a/BOJ/Silver/11660/main.py b/BOJ/Silver/11660/main.py index 9d2b1cc..9d8d6a4 100644 --- a/BOJ/Silver/11660/main.py +++ b/BOJ/Silver/11660/main.py @@ -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()) diff --git a/BOJ/Silver/1543/main.py b/BOJ/Silver/1543/main.py index 066d314..930f088 100644 --- a/BOJ/Silver/1543/main.py +++ b/BOJ/Silver/1543/main.py @@ -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: diff --git "a/Programmers/2020_KAKAO_BLIND_RECRUITMENT/\354\236\220\353\254\274\354\207\240\354\231\200_\354\227\264\354\207\240/main.py" "b/Programmers/2020_KAKAO_BLIND_RECRUITMENT/\354\236\220\353\254\274\354\207\240\354\231\200_\354\227\264\354\207\240/main.py" index 6216bc9..ea5f9f8 100644 --- "a/Programmers/2020_KAKAO_BLIND_RECRUITMENT/\354\236\220\353\254\274\354\207\240\354\231\200_\354\227\264\354\207\240/main.py" +++ "b/Programmers/2020_KAKAO_BLIND_RECRUITMENT/\354\236\220\353\254\274\354\207\240\354\231\200_\354\227\264\354\207\240/main.py" @@ -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]: diff --git "a/Programmers/Sort/K\353\262\210\354\247\270\354\210\230/main.py" "b/Programmers/Sort/K\353\262\210\354\247\270\354\210\230/main.py" index 31df063..c396245 100644 --- "a/Programmers/Sort/K\353\262\210\354\247\270\354\210\230/main.py" +++ "b/Programmers/Sort/K\353\262\210\354\247\270\354\210\230/main.py" @@ -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