0
0

More than 1 year has passed since last update.

ABC60 B - Choose Integers / C - Sentou 両方 diff 茶だった

Last updated at Posted at 2021-10-06

abc60b_1.png
abc60b_2.png
abc60b_3.png
abc60b_4.png

(B*n + C)%A == 0 を満たす、n を探そうと思った。
具体的には n を 1 から 10**6 まで全探索すれば一通り探索するイメージ。
Amax100,Bmax100,C<B だから、行けるでしょ。

ChooseIntegers.py
A,B,C = map(int,input().split())

for n in range(1,1+10**6):
    if (B*n+C)%A == 0:
        print("YES")
        exit()
print("NO")

abc60c_1.png
abc60c_2.png
abc60c_3.png
abc60c_4.png

うん。文章をそのまま書いてみた。

Sentou.py
N,T = map(int,input().split())
t = list(map(int,input().split()))

score = 0

for i in range(N-1):
    if t[i+1]-t[i] < T:
        score += t[i+1]-t[i]
    else:
        score += T

print(score+T)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0