結果
問題 | No.316 もっと刺激的なFizzBuzzをください |
ユーザー |
|
提出日時 | 2020-08-22 15:59:05 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 35 ms / 1,000 ms |
コード長 | 1,150 bytes |
コンパイル時間 | 244 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2024-09-13 02:57:40 |
合計ジャッジ時間 | 2,574 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
import sys, re, osfrom collections import deque, defaultdict, Counterfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radiansfrom itertools import permutations, combinations, product, accumulatefrom operator import itemgetter, mulfrom copy import deepcopyfrom string import ascii_lowercase, ascii_uppercase, digitsfrom math import gcdfrom bisect import bisect, bisect_left, bisect_rightdef 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 + 7N = 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 // miprint(ans)