結果

問題 No.1486 ロボット
ユーザー tktk_snsntktk_snsn
提出日時 2021-04-23 21:27:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 313 ms / 2,000 ms
コード長 304 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 10,732 KB
実行使用メモリ 8,064 KB
最終ジャッジ日時 2023-09-17 11:43:02
合計ジャッジ時間 2,612 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,912 KB
testcase_01 AC 15 ms
7,964 KB
testcase_02 AC 16 ms
7,912 KB
testcase_03 AC 16 ms
7,908 KB
testcase_04 AC 15 ms
7,900 KB
testcase_05 AC 16 ms
7,904 KB
testcase_06 AC 290 ms
8,024 KB
testcase_07 AC 313 ms
7,876 KB
testcase_08 AC 154 ms
7,880 KB
testcase_09 AC 16 ms
7,924 KB
testcase_10 AC 37 ms
7,900 KB
testcase_11 AC 37 ms
7,880 KB
testcase_12 AC 17 ms
7,984 KB
testcase_13 AC 17 ms
8,020 KB
testcase_14 AC 150 ms
7,984 KB
testcase_15 AC 40 ms
7,880 KB
testcase_16 AC 69 ms
7,948 KB
testcase_17 AC 73 ms
8,064 KB
testcase_18 AC 56 ms
7,996 KB
testcase_19 AC 32 ms
7,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
a, b, c, d, e = map(int, input().split())
AB = a + b
CD = c + d
L = AB * (CD // gcd(AB, CD))
loop = e // L

cnt = 0
for i in range(L):
    cnt += loop * ((i % AB) < a and (i % CD) < c)

rest = e - L * loop
for i in range(rest):
    cnt += ((i % AB) < a and (i % CD) < c)

print(cnt)
0