結果

問題 No.1486 ロボット
ユーザー brthyyjpbrthyyjp
提出日時 2021-04-25 13:21:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 416 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 87,232 KB
実行使用メモリ 78,984 KB
最終ジャッジ日時 2023-09-17 14:03:44
合計ジャッジ時間 3,499 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
72,348 KB
testcase_01 AC 106 ms
72,132 KB
testcase_02 AC 107 ms
72,324 KB
testcase_03 AC 109 ms
72,472 KB
testcase_04 AC 105 ms
72,088 KB
testcase_05 AC 107 ms
72,084 KB
testcase_06 AC 119 ms
78,984 KB
testcase_07 AC 119 ms
78,840 KB
testcase_08 AC 114 ms
77,820 KB
testcase_09 AC 105 ms
72,616 KB
testcase_10 AC 112 ms
77,052 KB
testcase_11 AC 111 ms
76,860 KB
testcase_12 AC 111 ms
76,912 KB
testcase_13 AC 107 ms
72,520 KB
testcase_14 AC 120 ms
77,416 KB
testcase_15 AC 118 ms
76,912 KB
testcase_16 AC 116 ms
77,312 KB
testcase_17 AC 115 ms
77,040 KB
testcase_18 AC 116 ms
77,292 KB
testcase_19 AC 117 ms
77,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a,b,c,d,e = map(int, input().split())

import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

l = lcm_base(a+b, c+d)
s = ('1'*a+'0'*b)*(l//(a+b))
t = ('1'*c+'0'*d)*(l//(c+d))

cnt = 0
for i in range(l):
    if s[i] == '1' and t[i] == '1':
        cnt += 1

q, r = divmod(e, l)
ans = cnt*q
for i in range(r):
    if s[i] == '1' and t[i] == '1':
        ans += 1
print(ans)
0