結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー Konton7
提出日時 2019-04-28 16:56:59
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 34 ms / 1,000 ms
コード長 379 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-16 11:02:31
合計ジャッジ時間 2,407 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

a, b, c = [ int(v) for v in input().split(" ") ]


def gcm(a,b):
    if a > b:
        a, b = b, a
    while a != 0:
        a, b = b % a, a
    return b

def lgm(a,b):
    return a*b//gcm(a,b)

def lgm3(a,b,c):
    return lgm(lgm(a,b),c)


nlist = [ n//a, n//b, n//c, -(n//(lgm(a,b))), -(n//(lgm(b,c))), -(n//(lgm(c,a))), n//(lgm3(a,b,c)) ]


print(sum(nlist))
0