結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,916 KB
testcase_01 AC 16 ms
7,992 KB
testcase_02 AC 17 ms
8,088 KB
testcase_03 AC 16 ms
7,992 KB
testcase_04 AC 16 ms
7,996 KB
testcase_05 AC 16 ms
8,048 KB
testcase_06 AC 166 ms
23,672 KB
testcase_07 AC 173 ms
23,748 KB
testcase_08 AC 85 ms
16,148 KB
testcase_09 AC 16 ms
7,988 KB
testcase_10 AC 27 ms
9,368 KB
testcase_11 AC 27 ms
9,240 KB
testcase_12 AC 17 ms
8,304 KB
testcase_13 AC 16 ms
8,052 KB
testcase_14 AC 92 ms
12,588 KB
testcase_15 AC 29 ms
8,976 KB
testcase_16 AC 42 ms
10,728 KB
testcase_17 AC 51 ms
9,948 KB
testcase_18 AC 36 ms
10,300 KB
testcase_19 AC 24 ms
8,700 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

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