Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some AtCoder ABC-B examples to examples/wip #145

Merged
merged 1 commit into from
Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()