結果

問題 No.1486 ロボット
ユーザー mag
提出日時 2021-04-29 20:11:52
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 187 ms / 2,000 ms
コード長 406 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 26,532 KB
最終ジャッジ日時 2024-07-16 04:50:14
合計ジャッジ時間 2,128 ms
ジャッジサーバーID
(参考情報)
judge3 / 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))

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

result = E // x * c
for i in range(E % x):
    if not y[i] or not z[i]:
        continue
    result += 1
print(result)
0