結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー brthyyjpbrthyyjp
提出日時 2020-04-26 06:17:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 46 ms / 1,000 ms
コード長 404 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 82,292 KB
実行使用メモリ 56,524 KB
最終ジャッジ日時 2024-04-27 14:58:06
合計ジャッジ時間 2,872 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
55,432 KB
testcase_01 AC 44 ms
55,892 KB
testcase_02 AC 45 ms
56,048 KB
testcase_03 AC 42 ms
54,716 KB
testcase_04 AC 42 ms
55,680 KB
testcase_05 AC 41 ms
55,880 KB
testcase_06 AC 41 ms
55,552 KB
testcase_07 AC 42 ms
55,204 KB
testcase_08 AC 41 ms
54,764 KB
testcase_09 AC 42 ms
55,984 KB
testcase_10 AC 44 ms
55,512 KB
testcase_11 AC 45 ms
56,524 KB
testcase_12 AC 43 ms
56,384 KB
testcase_13 AC 43 ms
56,504 KB
testcase_14 AC 44 ms
56,516 KB
testcase_15 AC 42 ms
54,864 KB
testcase_16 AC 42 ms
56,100 KB
testcase_17 AC 42 ms
54,852 KB
testcase_18 AC 43 ms
54,852 KB
testcase_19 AC 40 ms
55,496 KB
testcase_20 AC 41 ms
55,524 KB
testcase_21 AC 42 ms
55,356 KB
testcase_22 AC 42 ms
55,392 KB
testcase_23 AC 41 ms
54,856 KB
testcase_24 AC 43 ms
56,176 KB
testcase_25 AC 42 ms
55,096 KB
testcase_26 AC 43 ms
55,976 KB
testcase_27 AC 42 ms
55,852 KB
testcase_28 AC 43 ms
55,800 KB
testcase_29 AC 43 ms
55,436 KB
testcase_30 AC 46 ms
55,384 KB
testcase_31 AC 44 ms
55,888 KB
testcase_32 AC 41 ms
55,056 KB
testcase_33 AC 42 ms
56,084 KB
testcase_34 AC 41 ms
55,028 KB
testcase_35 AC 42 ms
55,408 KB
testcase_36 AC 41 ms
55,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#import fractions
import math
from functools import reduce
def 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//c
ans -= n//lcm_base(a, b) + n//lcm_base(b, c) + n//lcm_base(c, a)
ans += n//lcm_list([a, b, c])

print(ans)
0