結果
問題 |
No.316 もっと刺激的なFizzBuzzをください
|
ユーザー |
|
提出日時 | 2024-11-04 15:51:27 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 39 ms / 1,000 ms |
コード長 | 327 bytes |
コンパイル時間 | 368 ms |
コンパイル使用メモリ | 82,344 KB |
実行使用メモリ | 54,168 KB |
最終ジャッジ日時 | 2024-11-04 15:51:31 |
合計ジャッジ時間 | 3,520 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
import math from itertools import combinations N = int(input()) S = list(set(map(int, input().split()))) ans = 0 # 包除原理 for i in range(1, len(S) + 1): for c in combinations(S, i): g = math.lcm(*c) v = N // g if i % 2 == 1: ans += v else: ans -= v print(ans)