前回の振り返り
今日はABC開催日だったので参加結果を振り返る
今週はのA,Bの2完(0ペナ)
A
割り切れるかどうかだけ分岐して
割り算
ソースコード
main.py
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, Counter, deque
from functools import reduce, lru_cache
from itertools import product, accumulate, groupby, combinations
import sys
import os
def rI(): return int(sys.stdin.readline().rstrip())
def rLI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def rI1(): return (int(sys.stdin.readline().rstrip())-1)
def rLI1(): return list(map(lambda a:int(a)-1,sys.stdin.readline().rstrip().split()))
def rS(): return sys.stdin.readline().rstrip()
def rLS(): return list(sys.stdin.readline().rstrip().split())
IS_LOCAL = int(os.getenv("ATCODER", "0"))==0
err = (lambda *args, **kwargs: print(*args, **kwargs, file=sys.stderr)) if IS_LOCAL else (lambda *args, **kwargs: None)
def main():
A = rI()
ans = 400//A if 400%A==0 else -1
print(ans)
if __name__ == '__main__':
main()
B
普通に総和して
$10^9$超えるかどうかで分岐するだけ
ソースコード
main.py
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, Counter, deque
from functools import reduce, lru_cache
from itertools import product, accumulate, groupby, combinations
import sys
import os
def rI(): return int(sys.stdin.readline().rstrip())
def rLI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def rI1(): return (int(sys.stdin.readline().rstrip())-1)
def rLI1(): return list(map(lambda a:int(a)-1,sys.stdin.readline().rstrip().split()))
def rS(): return sys.stdin.readline().rstrip()
def rLS(): return list(sys.stdin.readline().rstrip().split())
IS_LOCAL = int(os.getenv("ATCODER", "0"))==0
err = (lambda *args, **kwargs: print(*args, **kwargs, file=sys.stderr)) if IS_LOCAL else (lambda *args, **kwargs: None)
def main():
N, M = rLI()
X = sum(N ** i for i in range(M+1))
ans = X if X <= 10**9 else "inf"
print(ans)
if __name__ == '__main__':
main()
C
小数点の管理ができなくて爆散
D
有向グラフ作ってBFSはしんどいて…
E
エラトステネスの篩を使うところまでは見立てることはできたが
全列挙できる発想は出なかった。
F
DP使いそうと思ったけど
漸化式わからん
G
これもDP使いそうと思ったけど
Alien DP ってなんですかそれ
感想
記念すべき400回目だし久々にratedしたら無事に冷えたので辛い
でもこの辛さから逃げ続けると余計やりづらくなるんですけどねl…