結果
| 問題 | No.316 もっと刺激的なFizzBuzzをください |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-22 15:59:05 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 158 ms / 1,000 ms |
| コード長 | 1,150 bytes |
| 記録 | |
| コンパイル時間 | 596 ms |
| コンパイル使用メモリ | 20,824 KB |
| 実行使用メモリ | 15,488 KB |
| 最終ジャッジ日時 | 2026-04-04 02:58:05 |
| 合計ジャッジ時間 | 5,936 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
ソースコード
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from math import gcd
from bisect import bisect, bisect_left, bisect_right
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
N = INT()
A = LIST()
def many_lcm(l):
tmp = l[0]
for i in range(1, len(l)):
tmp = tmp * l[i]//gcd(tmp, l[i])
return tmp
# a = N // 3 + N // 5 - N // 15
# print(a)
# exit()
mi = many_lcm(A)
a = many_lcm(A[0:2])
b = many_lcm(A[1:3])
c = many_lcm([A[0], A[2]])
# print(a, b, c)
# print(mi)
ans = N // A[0] + N // A[1] + N // A[2] - N // a - N // b - N // c + N // mi
print(ans)