結果
問題 | No.316 もっと刺激的なFizzBuzzをください |
ユーザー |
![]() |
提出日時 | 2020-04-26 06:17:07 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 48 ms / 1,000 ms |
コード長 | 404 bytes |
コンパイル時間 | 239 ms |
コンパイル使用メモリ | 82,140 KB |
実行使用メモリ | 56,980 KB |
最終ジャッジ日時 | 2024-11-15 17:58:44 |
合計ジャッジ時間 | 3,341 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
n = int(input())a, b, c = map(int, input().split())#import fractionsimport mathfrom functools import reducedef lcm_base(x, y):#return (x * y) // fractions.gcd(x, y)return (x * y) // math.gcd(x, y)def lcm_list(numbers):return reduce(lcm_base, numbers, 1)ans = n//a + n//b + n//cans -= n//lcm_base(a, b) + n//lcm_base(b, c) + n//lcm_base(c, a)ans += n//lcm_list([a, b, c])print(ans)