結果

問題 No.1486 ロボット
ユーザー miya145592
提出日時 2023-05-07 16:29:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 280 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 82,360 KB
実行使用メモリ 62,520 KB
最終ジャッジ日時 2024-11-24 15:56:33
合計ジャッジ時間 1,886 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
A, B, C, D, E = map(int, input().split())
ab = A+B
cd = C+D
G = math.gcd(ab, cd)
L = ab*cd//G
ans = 0
for i in range(L):
    if 0<=i%ab<A and 0<=i%cd<C:
        ans+=1
cnt = E//L
ans *= cnt
for i in range(E%L):
    if 0<=i%ab<A and 0<=i%cd<C:
        ans+=1
print(ans)
0