Skip to content

Commit

Permalink
Merge pull request #145 from uta8a/add-wip-example
Browse files Browse the repository at this point in the history
Add some AtCoder ABC-B examples to `examples/wip`
  • Loading branch information
kmyk authored Aug 5, 2021
2 parents b5b510d + 8520135 commit 3da0762
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 0 deletions.
19 changes: 19 additions & 0 deletions examples/wip/abc200_b.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# https://atcoder.jp/contests/abc200/tasks/abc200_b

from typing import *

def solve(n: int, k: int) -> int:
for _ in range(k):
if n % 200 == 0:
n //= 200
else:
n = n*1000 + 200
return n

def main() -> None:
n, k = map(int, input().split())
ans = solve(n, k)
print(ans)

if __name__ == '__main__':
main()
19 changes: 19 additions & 0 deletions examples/wip/abc203_b.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# https://atcoder.jp/contests/abc203/tasks/abc203_b

from typing import *

def solve(n: int, k: int) -> int:
a = []
for i in range(1,n+1):
for j in range(1,k+1):
a.append(100*i + j)
ans = sum(a)
return ans

def main() -> None:
n, k = map(int, input().split())
ans = solve(n, k)
print(ans)

if __name__ == '__main__':
main()
20 changes: 20 additions & 0 deletions examples/wip/abc204_b.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# https://atcoder.jp/contests/abc204/tasks/abc204_b

from typing import *

def solve(n: int, a: List[int]) -> int:
ans = 0
for e in a:
if e > 10:
ans += e - 10
return ans

def main() -> None:
n = int(input())
a = list(map(int, input().split()))
assert len(a) == n
ans = solve(n, a)
print(ans)

if __name__ == '__main__':
main()
22 changes: 22 additions & 0 deletions examples/wip/abc206_b.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# https://atcoder.jp/contests/abc206/tasks/abc206_b

from typing import *

def solve(n: int) -> int:
c = 0
ans = 0
flag = True
for i in range(100000): # (10^5)^2 > 10^9
c += i
if c >= n and flag:
ans = i
flag = False
return ans

def main() -> None:
n = int(input())
ans = solve(n)
print(ans)

if __name__ == '__main__':
main()
17 changes: 17 additions & 0 deletions examples/wip/abc207_b.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# https://atcoder.jp/contests/abc207/tasks/abc207_b

from typing import *

def solve(a: int, b: int, c: int, d: int) -> int:
ans = -1
if d*c - b > 0:
ans = (a + d*c - b - 1) // (d*c - b) # ans = a /^ (d*c - b)
return ans

def main() -> None:
a, b, c, d = map(int, input().split())
ans = solve(a, b, c, d)
print(ans)

if __name__ == '__main__':
main()
23 changes: 23 additions & 0 deletions examples/wip/abc208_b.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# https://atcoder.jp/contests/abc208/tasks/abc208_b

from typing import *

def solve(p: int) -> int:
e = 1
cs = []
ans = 0
for i in range(10):
e *= i+1
cs.append(e)
for c in reversed(cs):
ans += p//c
p -= p//c * c
return ans

def main() -> None:
p = int(input())
ans = solve(p)
print(ans)

if __name__ == '__main__':
main()

0 comments on commit 3da0762

Please sign in to comment.