結果

問題 No.1486 ロボット
ユーザー stng
提出日時 2021-09-06 20:10:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 355 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 77,364 KB
最終ジャッジ日時 2024-12-22 20:15:42
合計ジャッジ時間 2,163 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

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

on = a+b
tw = c+d

prd = (on*tw)//math.gcd(on,tw)

li = [0]*(prd)

for i in range(prd):
    if i%on <= a-1 and i%tw <= c-1:
        li[i] = 1

rui = [0]*(prd+1)

for i in range(prd):
    rui[i+1] = rui[i]+li[i]
#print(li)
#print(rui)
#print(prd,e%prd)

prd_sum = sum(li)
print(prd_sum*(e//prd)+rui[e%prd])
0