結果

問題 No.1486 ロボット
ユーザー Meso Meso
提出日時 2024-09-06 20:14:45
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 199 ms / 2,000 ms
コード長 401 bytes
コンパイル時間 486 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 26,388 KB
最終ジャッジ日時 2024-09-06 20:14:48
合計ジャッジ時間 2,769 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

a, b, c, d, e = map(int, input().split())

x = (a+b) * (c+d) // gcd(a+b, c+d)
y = ([True] * a + [False] * b) * (x // (a+b))
z = ([True] * c + [False] * d) * (x // (c+d))

cnt = 0
for i in range(x):
    if not y[i] or not z[i]:
        continue
    cnt += 1

result = e // x * cnt
for i in range(e % x):
    if not y[i] or not z[i]:
        continue
    result += 1

print(result)
0