結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー lllllll88938494
提出日時 2023-06-15 18:12:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 1,000 ms
コード長 465 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 81,912 KB
実行使用メモリ 54,004 KB
最終ジャッジ日時 2024-06-23 17:01:31
合計ジャッジ時間 2,710 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import ceil,floor,sqrt,gcd,factorial 
def  lcm(a,b):
    return a*b // gcd(a,b)

n=int(input())
a,b,c = map(int,input().split())
z = [a]
if b%a:
    z.append(b)
if c%a and c%b:
    z.append(c)

if len(z) == 1:
    print(n//z[0])
elif len(z) == 2:
    a=z[0]
    b=z[1]
    print(n//a + n//b  - n//(lcm(a,b)))
else:
    a=z[0]
    b=z[1]
    c=z[2]
    print(n//a + n//b + n//c - n//(lcm(a,b)) - n//(lcm(a,c)) - n//(lcm(b,c)) + n//(lcm(lcm(a,b),c)))
    

0