結果

問題 No.1486 ロボット
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-04-23 21:24:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 315 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 10,760 KB
実行使用メモリ 31,844 KB
最終ジャッジ日時 2023-09-17 11:38:07
合計ジャッジ時間 1,716 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,932 KB
testcase_01 AC 16 ms
8,092 KB
testcase_02 AC 16 ms
7,996 KB
testcase_03 AC 16 ms
7,972 KB
testcase_04 AC 16 ms
7,944 KB
testcase_05 AC 16 ms
7,928 KB
testcase_06 AC 119 ms
31,836 KB
testcase_07 AC 118 ms
31,844 KB
testcase_08 AC 69 ms
20,068 KB
testcase_09 AC 16 ms
8,056 KB
testcase_10 AC 24 ms
9,992 KB
testcase_11 AC 24 ms
10,124 KB
testcase_12 AC 16 ms
8,372 KB
testcase_13 AC 16 ms
8,044 KB
testcase_14 AC 50 ms
15,904 KB
testcase_15 AC 23 ms
9,984 KB
testcase_16 AC 33 ms
12,112 KB
testcase_17 AC 30 ms
11,520 KB
testcase_18 AC 32 ms
11,612 KB
testcase_19 AC 21 ms
9,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
a, b, c, d, e = map(int, input().split())
t = (a + b) * (c + d) // gcd(a + b, c + d)
tmp1 = [1] * a + [0] * b
tmp2 = [1] * c + [0] * d
l1, l2 = tmp1 * (t // (a + b)), tmp2 * (t // (c + d))
l = [1 if l1[i] and l2[i] else 0 for i in range(t)]
cnt = l.count(1)
print(e // t * cnt + sum(l[:e % t]))
0