結果

問題 No.1486 ロボット
ユーザー kohei2019kohei2019
提出日時 2022-06-07 00:19:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 321 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 81,704 KB
実行使用メモリ 61,912 KB
最終ジャッジ日時 2023-10-21 03:43:23
合計ジャッジ時間 2,294 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,564 KB
testcase_01 AC 34 ms
53,564 KB
testcase_02 AC 37 ms
53,564 KB
testcase_03 AC 39 ms
53,564 KB
testcase_04 AC 37 ms
53,564 KB
testcase_05 AC 36 ms
53,564 KB
testcase_06 AC 46 ms
59,700 KB
testcase_07 AC 46 ms
59,700 KB
testcase_08 AC 42 ms
59,692 KB
testcase_09 AC 36 ms
53,564 KB
testcase_10 AC 41 ms
59,700 KB
testcase_11 AC 39 ms
59,700 KB
testcase_12 AC 41 ms
59,700 KB
testcase_13 AC 36 ms
53,564 KB
testcase_14 AC 47 ms
61,896 KB
testcase_15 AC 44 ms
61,904 KB
testcase_16 AC 45 ms
61,904 KB
testcase_17 AC 44 ms
61,912 KB
testcase_18 AC 48 ms
61,904 KB
testcase_19 AC 46 ms
61,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
A,B,C,D,E = map(int,input().split())
AB = A+B
CD = C+D
gcd = math.gcd(AB,CD)
lcm = (AB*CD)//gcd
cnt = 0
for i in range(1,lcm+1):
    if (i-1)%AB < A and (i-1)%CD < C:
        cnt += 1
ans = (E // lcm) * cnt
rm = E % lcm
for i in range(1,rm+1):
    if (i-1)%AB < A and (i-1)%CD < C:
        ans += 1
print(ans)
0