結果

問題 No.1486 ロボット
ユーザー NoaSaber
提出日時 2021-04-23 22:30:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 923 ms / 2,000 ms
コード長 279 bytes
コンパイル時間 513 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 61,696 KB
最終ジャッジ日時 2024-07-04 08:19:53
合計ジャッジ時間 3,821 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

A,B,C,D,E=map(int,input().split())
import math
ptA,ptB=A+B,C+D
S=math.gcd(ptA,ptB)*(ptA)*(ptB)
cnt_cir=0
ans=0
for i in range(S):
    if i%ptA<A and i%ptB<C:
        cnt_cir+=1
ans+=cnt_cir*(E//S)
E-=E//S*S
for i in range(E):
    if i%ptA<A and i%ptB<C:
        ans+=1
print(ans)
0