結果

問題 No.1486 ロボット
ユーザー AAAR SalmonAAAR Salmon
提出日時 2021-05-15 11:20:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 219 ms / 2,000 ms
コード長 403 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 18,692 KB
最終ジャッジ日時 2024-04-10 15:44:09
合計ジャッジ時間 2,235 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
11,008 KB
testcase_01 AC 26 ms
10,752 KB
testcase_02 AC 26 ms
10,880 KB
testcase_03 AC 26 ms
10,880 KB
testcase_04 AC 26 ms
10,880 KB
testcase_05 AC 26 ms
10,752 KB
testcase_06 AC 219 ms
18,692 KB
testcase_07 AC 210 ms
18,632 KB
testcase_08 AC 122 ms
14,844 KB
testcase_09 AC 26 ms
10,880 KB
testcase_10 AC 40 ms
11,264 KB
testcase_11 AC 38 ms
11,392 KB
testcase_12 AC 25 ms
11,008 KB
testcase_13 AC 25 ms
10,880 KB
testcase_14 AC 80 ms
14,080 KB
testcase_15 AC 39 ms
11,392 KB
testcase_16 AC 59 ms
12,544 KB
testcase_17 AC 50 ms
12,288 KB
testcase_18 AC 54 ms
11,904 KB
testcase_19 AC 34 ms
11,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import reduce
from math import gcd


A,B,C,D,E = map(int,input().split())
T = (A + B) * (C + D) // gcd(A + B, C + D)
dp = [0] * T
for t in range(0, T, A + B):
	dp[t] += 1
for t in range(A, T, A + B):
	dp[t] -= 1
for t in range(0, T, C + D):
	dp[t] += 1
for t in range(C, T, C + D):
	dp[t] -= 1
for t in range(T - 1):
	dp[t + 1] += dp[t]

print(E // T * dp.count(2) + dp[:E % T].count(2))
0