結果

問題 No.1486 ロボット
ユーザー c-yanc-yan
提出日時 2021-04-24 01:05:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 172 ms / 2,000 ms
コード長 407 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 10,588 KB
実行使用メモリ 23,688 KB
最終ジャッジ日時 2023-09-17 13:18:18
合計ジャッジ時間 1,939 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,036 KB
testcase_01 AC 15 ms
7,988 KB
testcase_02 AC 16 ms
8,008 KB
testcase_03 AC 18 ms
7,864 KB
testcase_04 AC 17 ms
8,060 KB
testcase_05 AC 17 ms
7,956 KB
testcase_06 AC 172 ms
23,664 KB
testcase_07 AC 167 ms
23,688 KB
testcase_08 AC 89 ms
15,908 KB
testcase_09 AC 16 ms
8,060 KB
testcase_10 AC 27 ms
9,204 KB
testcase_11 AC 27 ms
9,248 KB
testcase_12 AC 16 ms
8,356 KB
testcase_13 AC 16 ms
7,984 KB
testcase_14 AC 87 ms
12,348 KB
testcase_15 AC 29 ms
9,084 KB
testcase_16 AC 42 ms
10,688 KB
testcase_17 AC 54 ms
9,832 KB
testcase_18 AC 37 ms
10,380 KB
testcase_19 AC 24 ms
8,780 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