結果

問題 No.1486 ロボット
ユーザー stngstng
提出日時 2021-09-06 20:10:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 98 ms / 2,000 ms
コード長 355 bytes
コンパイル時間 537 ms
コンパイル使用メモリ 86,700 KB
実行使用メモリ 91,724 KB
最終ジャッジ日時 2023-08-24 12:57:53
合計ジャッジ時間 3,390 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,472 KB
testcase_01 AC 71 ms
71,240 KB
testcase_02 AC 70 ms
71,232 KB
testcase_03 AC 71 ms
71,208 KB
testcase_04 AC 71 ms
71,436 KB
testcase_05 AC 71 ms
71,232 KB
testcase_06 AC 97 ms
91,668 KB
testcase_07 AC 98 ms
91,724 KB
testcase_08 AC 88 ms
83,984 KB
testcase_09 AC 72 ms
71,464 KB
testcase_10 AC 80 ms
77,096 KB
testcase_11 AC 80 ms
77,292 KB
testcase_12 AC 78 ms
76,080 KB
testcase_13 AC 70 ms
71,328 KB
testcase_14 AC 84 ms
80,384 KB
testcase_15 AC 80 ms
77,108 KB
testcase_16 AC 82 ms
78,456 KB
testcase_17 AC 81 ms
77,936 KB
testcase_18 AC 81 ms
78,276 KB
testcase_19 AC 79 ms
76,704 KB
権限があれば一括ダウンロードができます

ソースコード

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