結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー ssmkzkssmkzk
提出日時 2019-06-28 01:59:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 588 bytes
コンパイル時間 194 ms
コンパイル使用メモリ 10,848 KB
実行使用メモリ 8,512 KB
最終ジャッジ日時 2023-09-14 21:09:16
合計ジャッジ時間 2,844 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,296 KB
testcase_01 WA -
testcase_02 AC 16 ms
8,428 KB
testcase_03 AC 16 ms
8,460 KB
testcase_04 AC 16 ms
8,284 KB
testcase_05 WA -
testcase_06 AC 16 ms
8,016 KB
testcase_07 AC 16 ms
8,252 KB
testcase_08 AC 16 ms
8,392 KB
testcase_09 AC 16 ms
8,240 KB
testcase_10 AC 16 ms
8,248 KB
testcase_11 AC 16 ms
8,284 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 16 ms
8,300 KB
testcase_15 AC 16 ms
8,448 KB
testcase_16 AC 16 ms
8,404 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 17 ms
8,432 KB
testcase_24 AC 16 ms
8,300 KB
testcase_25 WA -
testcase_26 AC 16 ms
8,440 KB
testcase_27 AC 16 ms
8,424 KB
testcase_28 AC 16 ms
8,288 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 16 ms
8,428 KB
testcase_32 WA -
testcase_33 AC 16 ms
8,236 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

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

p_a = N // a
p_b = N // b
p_c = N // c
p_ab = N // (a*b)
p_bc = N // (b*c)
p_ca = N // (c*a)
p_abc = N // (a*b*c)



if math.gcd(math.gcd(a,b),c) == min(a,b,c):
    print(N// min(a,b,c))
elif math.gcd(a,b) == min(a,b):
    print(p_c + (N // min(a, b)) - (N // (min(a,b) * c)) )
elif math.gcd(b,c) == min(b,c):
    print(p_a + (N // min(b, c)) - (N // (min(b,c) * a)) )
elif math.gcd(c,a) == min(c,a):
    print(p_b + (N // min(c, a)) - (N // (min(c,a) * b)) )
else:
    print(p_a + p_b + p_c - p_ab - p_bc - p_ca + p_abc)
0