結果

問題 No.1486 ロボット
ユーザー 👑 rin204
提出日時 2021-08-05 17:56:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 68,480 KB
最終ジャッジ日時 2024-09-16 15:21:42
合計ジャッジ時間 1,823 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

a, b, c, d, e = map(int, input().split())
loop = (a + b) * (c + d) // gcd(a + b, c + d)
tmp = [False] * loop
for i in range(loop):
    if i % (a + b) < a and i % (c + d) < c:
        tmp[i] = True

ans = e // loop * tmp.count(True)
for i in range(e % loop):
    if tmp[i]:
        ans += 1
print(ans)
0