結果

問題 No.1486 ロボット
ユーザー mahiro72
提出日時 2021-10-09 20:51:52
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 197 ms / 2,000 ms
コード長 326 bytes
コンパイル時間 388 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 26,484 KB
最終ジャッジ日時 2024-09-13 10:09:07
合計ジャッジ時間 2,579 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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

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