結果

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

ソースコード

diff #

import math
def lcm(a,b):		return a*b//math.gcd(a,b)
def ncm(n,a,b):		return n//lcm(a,b)
def ncn(n,a,b,c):	return n//lcm(lcm(a,b),c)
N = int(input())
a, b, c = [int(x) for x in input().split()]
n = N//a + N//b + N//c - ncm(N,a,b) - ncm(N,b,c) - ncm(N,c,a) + ncn(N,a,b,c)
print(n)
0