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 a975a59 commit 86c0023
Show file tree
Hide file tree
Showing 137 changed files with 558 additions and 496 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Formatter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ jobs:
git push
else
echo "No code changes."
fi
fi
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
**/*.pdf
*.ini
.DS_Store
Study
Study
2 changes: 1 addition & 1 deletion BOJ/Diamond/13705 (Incompleted)/Legacy/ver1.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def f(A, B, C, x):


def fp(A, B, x):
return - A - B * math.cos(x)
return -A - B * math.cos(x)


def newrap(A, B, C, x):
Expand Down
8 changes: 4 additions & 4 deletions BOJ/Gold/10026/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
read = sys.stdin.readline

N = int(read())
l = [['' for _ in range(N)] for _ in range(N)]
juklock = [['' for _ in range(N)] for _ in range(N)]
l = [["" for _ in range(N)] for _ in range(N)]
juklock = [["" for _ in range(N)] for _ in range(N)]
for i in range(N):
l[i] = list(read().rstrip())
for j in range(N):
if l[i][j] == 'G':
juklock[i][j] = 'R'
if l[i][j] == "G":
juklock[i][j] = "R"
else:
juklock[i][j] = l[i][j]

Expand Down
4 changes: 2 additions & 2 deletions BOJ/Gold/1011/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
for _ in range(T):
a, b = map(int, read().split())
tmp = b - a
max = int(tmp ** 0.5)
tmp -= max ** 2
max = int(tmp**0.5)
tmp -= max**2
cnt = 2 * max - 1
if tmp % max == 0:
cnt += tmp // max
Expand Down
2 changes: 1 addition & 1 deletion BOJ/Gold/1013/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
T = int(read())
for _ in range(T):
S = read().strip()
p = re.compile('(100+1+|01)+')
p = re.compile("(100+1+|01)+")
res = p.fullmatch(S)
if res:
print("YES")
Expand Down
14 changes: 11 additions & 3 deletions BOJ/Gold/1041/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,23 @@
for i in tmp:
d2 = min(d2, l[i[0]] + l[i[1]])

tmp = ((0, 1, 2), (0, 1, 3), (0, 2, 4), (0, 3, 4),
(5, 1, 2), (5, 1, 3), (5, 2, 4), (5, 3, 4))
tmp = (
(0, 1, 2),
(0, 1, 3),
(0, 2, 4),
(0, 3, 4),
(5, 1, 2),
(5, 1, 3),
(5, 2, 4),
(5, 3, 4),
)

d3 = sys.maxsize
for i in tmp:
d3 = min(d3, l[i[0]] + l[i[1]] + l[i[2]])

d2n = (N - 1) * 4 + (N - 2) * 4
d3n = 4
d1n = N ** 3 - ((N - 1) * (N - 2) * (N - 2)) - d2n - d3n
d1n = N**3 - ((N - 1) * (N - 2) * (N - 2)) - d2n - d3n

print(d1 * d1n + d2 * d2n + d3 * d3n)
20 changes: 6 additions & 14 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 All @@ -23,18 +23,10 @@ def Palindrome(s, idx1, idx2):
if idx1 >= idx2:
return 0
res = min(
Palindrome(
s,
idx1 + 1,
idx2) + 1,
Palindrome(
s,
idx1,
idx2 - 1) + 1,
Palindrome(
s,
idx1 + 1,
idx2 - 1) + 1)
Palindrome(s, idx1 + 1, idx2) + 1,
Palindrome(s, idx1, idx2 - 1) + 1,
Palindrome(s, idx1 + 1, idx2 - 1) + 1,
)
cache[idx1][idx2] = res
return res

Expand Down
2 changes: 1 addition & 1 deletion BOJ/Gold/1062/Legacy/ver1.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

s = set()
wordset = []
antic = set('antic')
antic = set("antic")
tupleantic = tuple(antic)

for i in range(N):
Expand Down
12 changes: 6 additions & 6 deletions BOJ/Gold/1062/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

s = set()
wordset = []
antic = set('antic')
antic = set("antic")

for i in range(N):
word = read().rstrip()
tmpwordset = set(word)
wordset.append(tmpwordset)

s = set(chr(i) for i in range(ord('a'), ord('z') + 1)) - antic
s = set(chr(i) for i in range(ord("a"), ord("z") + 1)) - antic

if K < 5:
print(0)
Expand All @@ -24,20 +24,20 @@
res = 0
l = [False for _ in range(26)]
for ch in antic:
l[ord(ch) - ord('a')] = True
l[ord(ch) - ord("a")] = True
for teach in combinations(s, K - 5):
tmp = 0
for t in teach:
l[ord(t) - ord('a')] = True
l[ord(t) - ord("a")] = True
for word in wordset:
status = True
for w in word:
if not l[ord(w) - ord('a')]:
if not l[ord(w) - ord("a")]:
status = False
break
if status:
tmp += 1
for t in teach:
l[ord(t) - ord('a')] = False
l[ord(t) - ord("a")] = False
res = max(res, tmp)
print(res)
2 changes: 1 addition & 1 deletion BOJ/Gold/10868/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys

sys.setrecursionlimit(10 ** 9)
sys.setrecursionlimit(10**9)
read = sys.stdin.readline


Expand Down
5 changes: 3 additions & 2 deletions BOJ/Gold/11049/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
x = i + j
dp[j][x] = sys.maxsize
for k in range(j, x):
dp[j][x] = min(dp[j][x], dp[j][k] + dp[k + 1]
[x] + l[j][0] * l[k][1] * l[x][1])
dp[j][x] = min(
dp[j][x], dp[j][k] + dp[k + 1][x] + l[j][0] * l[k][1] * l[x][1]
)

print(dp[0][N - 1])
4 changes: 2 additions & 2 deletions BOJ/Gold/11404/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
for i in res:
for j in i:
if j == INF:
print(0, end=' ')
print(0, end=" ")
else:
print(j, end=' ')
print(j, end=" ")
print()
2 changes: 1 addition & 1 deletion BOJ/Gold/1174/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

for i in range(1, 10):
for j in combinations(l, i):
res.append(int(''.join(j[::-1])))
res.append(int("".join(j[::-1])))

res.sort()
res.append(9876543210)
Expand Down
12 changes: 8 additions & 4 deletions BOJ/Gold/12100/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@

def n2n(i, j, dir):
while True:
if not (((0 <= i < N) and (0 <= j < N)) and (
(0 <= i + dir[1] < N) and (0 <= j + dir[0] < N))):
if not (
((0 <= i < N) and (0 <= j < N))
and ((0 <= i + dir[1] < N) and (0 <= j + dir[0] < N))
):
break
elif not G[i][j] == 0:
if G[i + dir[1]][j + dir[0]
] == G[i][j] and not visited[i + dir[1]][j + dir[0]]:
if (
G[i + dir[1]][j + dir[0]] == G[i][j]
and not visited[i + dir[1]][j + dir[0]]
):
G[i + dir[1]][j + dir[0]] = G[i][j] * 2
G[i][j] = 0
visited[i + dir[1]][j + dir[0]] = True
Expand Down
10 changes: 6 additions & 4 deletions BOJ/Gold/1275/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ def init(node, start, end):
tree[node] = l[start]
return tree[node]
else:
tree[node] = init(node * 2, start, (start + end) // 2) + \
init(node * 2 + 1, (start + end) // 2 + 1, end)
tree[node] = init(node * 2, start, (start + end) // 2) + init(
node * 2 + 1, (start + end) // 2 + 1, end
)
return tree[node]


Expand All @@ -27,8 +28,9 @@ def segSum(node, start, end, left, right):
return 0
if left <= start and end <= right:
return tree[node]
return segSum(node * 2, start, (start + end) // 2, left, right) + \
segSum(node * 2 + 1, (start + end) // 2 + 1, end, left, right)
return segSum(node * 2, start, (start + end) // 2, left, right) + segSum(
node * 2 + 1, (start + end) // 2 + 1, end, left, right
)


N, Q = map(int, read().split())
Expand Down
3 changes: 1 addition & 2 deletions BOJ/Gold/12851/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ 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
6 changes: 3 additions & 3 deletions BOJ/Gold/12865/Legacy/ver1.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
tmpbin = bin(i)
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 = ["0" for j in range(N)]
idx[N - len(binidx) :] = binidx
totW = 0
totV = 0
for j in range(N):
if idx[j] == '1':
if idx[j] == "1":
totW = totW + W[j]
totV = totV + V[j]
if totW <= K:
Expand Down
6 changes: 4 additions & 2 deletions BOJ/Gold/12869/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ def solution(x, y, z, cnt):
while len(SCV) < 3:
SCV += [0]
ans = 100
dp = [[[100] * (max(SCV) + 1) for i in range((max(SCV) + 1))]
for j in range((max(SCV) + 1))]
dp = [
[[100] * (max(SCV) + 1) for i in range((max(SCV) + 1))]
for j in range((max(SCV) + 1))
]
solution(SCV[0], SCV[1], SCV[2], 0)
print(ans)
2 changes: 1 addition & 1 deletion BOJ/Gold/1339/Legacy/ver1.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
res = 0
for i, j in enumerate(l):
for k in j:
res += 10 ** i * d[k]
res += 10**i * d[k]

print(res)
2 changes: 1 addition & 1 deletion BOJ/Gold/1339/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
for i in range(N):
tmp = read().rstrip()
for j, k in enumerate(tmp[::-1]):
l[ord(k) - ord('A')] += 10 ** j
l[ord(k) - ord("A")] += 10**j

l.sort(reverse=True)

Expand Down
Loading

0 comments on commit 86c0023

Please sign in to comment.