結果

問題 No.1486 ロボット
ユーザー magmag
提出日時 2021-04-29 20:11:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 175 ms / 2,000 ms
コード長 406 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 10,604 KB
実行使用メモリ 23,728 KB
最終ジャッジ日時 2023-09-23 04:46:49
合計ジャッジ時間 2,243 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,004 KB
testcase_01 AC 16 ms
7,900 KB
testcase_02 AC 16 ms
8,076 KB
testcase_03 AC 16 ms
7,992 KB
testcase_04 AC 16 ms
7,908 KB
testcase_05 AC 16 ms
7,952 KB
testcase_06 AC 174 ms
23,572 KB
testcase_07 AC 175 ms
23,728 KB
testcase_08 AC 87 ms
15,988 KB
testcase_09 AC 16 ms
7,964 KB
testcase_10 AC 27 ms
9,380 KB
testcase_11 AC 27 ms
9,256 KB
testcase_12 AC 17 ms
8,436 KB
testcase_13 AC 16 ms
8,032 KB
testcase_14 AC 87 ms
12,500 KB
testcase_15 AC 29 ms
9,068 KB
testcase_16 AC 41 ms
10,560 KB
testcase_17 AC 50 ms
9,856 KB
testcase_18 AC 36 ms
10,316 KB
testcase_19 AC 25 ms
8,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

A, B, C, D, E = map(int, input().split())

x = (A + B) * (C + D) // gcd(A + B, C + D)
y = ([True] * A + [False] * B) * (x // (A + B))
z = ([True] * C + [False] * D) * (x // (C + D))

c = 0
for i in range(x):
    if not y[i] or not z[i]:
        continue
    c += 1

result = E // x * c
for i in range(E % x):
    if not y[i] or not z[i]:
        continue
    result += 1
print(result)
0