結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー burita083burita083
提出日時 2022-04-30 09:44:53
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 21 ms / 1,000 ms
コード長 398 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 10,616 KB
実行使用メモリ 8,908 KB
最終ジャッジ日時 2023-09-12 02:12:55
合計ジャッジ時間 2,666 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
8,780 KB
testcase_01 AC 20 ms
8,776 KB
testcase_02 AC 21 ms
8,776 KB
testcase_03 AC 21 ms
8,900 KB
testcase_04 AC 21 ms
8,720 KB
testcase_05 AC 20 ms
8,720 KB
testcase_06 AC 20 ms
8,892 KB
testcase_07 AC 21 ms
8,632 KB
testcase_08 AC 21 ms
8,832 KB
testcase_09 AC 21 ms
8,876 KB
testcase_10 AC 21 ms
8,844 KB
testcase_11 AC 20 ms
8,844 KB
testcase_12 AC 21 ms
8,880 KB
testcase_13 AC 21 ms
8,720 KB
testcase_14 AC 20 ms
8,872 KB
testcase_15 AC 21 ms
8,704 KB
testcase_16 AC 20 ms
8,784 KB
testcase_17 AC 20 ms
8,760 KB
testcase_18 AC 20 ms
8,704 KB
testcase_19 AC 20 ms
8,812 KB
testcase_20 AC 20 ms
8,872 KB
testcase_21 AC 20 ms
8,852 KB
testcase_22 AC 20 ms
8,732 KB
testcase_23 AC 20 ms
8,780 KB
testcase_24 AC 21 ms
8,776 KB
testcase_25 AC 20 ms
8,780 KB
testcase_26 AC 20 ms
8,696 KB
testcase_27 AC 21 ms
8,720 KB
testcase_28 AC 20 ms
8,692 KB
testcase_29 AC 20 ms
8,768 KB
testcase_30 AC 21 ms
8,724 KB
testcase_31 AC 21 ms
8,692 KB
testcase_32 AC 21 ms
8,632 KB
testcase_33 AC 21 ms
8,696 KB
testcase_34 AC 20 ms
8,908 KB
testcase_35 AC 20 ms
8,720 KB
testcase_36 AC 21 ms
8,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a, b, c = map(int, input().split())
L = [a, b, c]
from math import gcd
from functools import reduce

def f(*args):
    lcm = reduce(lambda x,y: x*y//gcd(x,y), args, 1)
    return n//lcm

import itertools
ans = 0
for i in range(1, 4):
    C = itertools.combinations(L, i)
    for c in C:
      if i % 2 == 0:
        ans -= f(*c)
      else:
        ans += f(*c)
print(ans)
        
0