結果
問題 |
No.1486 ロボット
|
ユーザー |
![]() |
提出日時 | 2021-04-25 13:21:43 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 63 ms / 2,000 ms |
コード長 | 416 bytes |
コンパイル時間 | 522 ms |
コンパイル使用メモリ | 82,816 KB |
実行使用メモリ | 64,512 KB |
最終ジャッジ日時 | 2024-07-04 09:26:27 |
合計ジャッジ時間 | 2,260 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
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)