結果
問題 | No.1809 Divide NCK |
ユーザー | U S |
提出日時 | 2022-01-14 23:06:10 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 130 ms / 2,000 ms |
コード長 | 1,860 bytes |
コンパイル時間 | 496 ms |
コンパイル使用メモリ | 87,200 KB |
実行使用メモリ | 78,600 KB |
最終ジャッジ日時 | 2023-08-12 21:54:32 |
合計ジャッジ時間 | 7,513 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 109 ms
74,400 KB |
testcase_01 | AC | 126 ms
78,300 KB |
testcase_02 | AC | 112 ms
74,428 KB |
testcase_03 | AC | 111 ms
74,564 KB |
testcase_04 | AC | 109 ms
74,468 KB |
testcase_05 | AC | 110 ms
74,480 KB |
testcase_06 | AC | 111 ms
74,048 KB |
testcase_07 | AC | 110 ms
74,304 KB |
testcase_08 | AC | 112 ms
74,048 KB |
testcase_09 | AC | 110 ms
74,472 KB |
testcase_10 | AC | 112 ms
74,120 KB |
testcase_11 | AC | 128 ms
78,172 KB |
testcase_12 | AC | 127 ms
78,372 KB |
testcase_13 | AC | 113 ms
78,188 KB |
testcase_14 | AC | 116 ms
78,292 KB |
testcase_15 | AC | 116 ms
78,296 KB |
testcase_16 | AC | 125 ms
78,288 KB |
testcase_17 | AC | 114 ms
78,180 KB |
testcase_18 | AC | 126 ms
78,168 KB |
testcase_19 | AC | 130 ms
78,112 KB |
testcase_20 | AC | 125 ms
78,344 KB |
testcase_21 | AC | 123 ms
78,220 KB |
testcase_22 | AC | 110 ms
74,300 KB |
testcase_23 | AC | 109 ms
74,308 KB |
testcase_24 | AC | 111 ms
74,404 KB |
testcase_25 | AC | 111 ms
74,120 KB |
testcase_26 | AC | 113 ms
74,044 KB |
testcase_27 | AC | 111 ms
74,372 KB |
testcase_28 | AC | 115 ms
74,336 KB |
testcase_29 | AC | 127 ms
78,084 KB |
testcase_30 | AC | 126 ms
78,416 KB |
testcase_31 | AC | 114 ms
78,224 KB |
testcase_32 | AC | 124 ms
78,088 KB |
testcase_33 | AC | 119 ms
78,288 KB |
testcase_34 | AC | 120 ms
78,260 KB |
testcase_35 | AC | 120 ms
78,332 KB |
testcase_36 | AC | 122 ms
78,052 KB |
testcase_37 | AC | 125 ms
78,344 KB |
testcase_38 | AC | 120 ms
78,152 KB |
testcase_39 | AC | 126 ms
78,088 KB |
testcase_40 | AC | 123 ms
78,600 KB |
testcase_41 | AC | 119 ms
78,216 KB |
ソースコード
# import sys # input = sys.stdin.readline def mp():return map(int,input().split()) def lmp():return list(map(int,input().split())) def mps(A):return [tuple(map(int, input().split())) for _ in range(A)] def stoi(LIST):return list(map(int,LIST)) def itos(LIST):return list(map(str,LIST)) def bitA(X,A):return X & 1<<A == 1<<A import math import bisect import heapq import time from copy import copy as cc from copy import deepcopy as dc from itertools import accumulate from collections import Counter, defaultdict, deque def ceil(U,V):return (U+V-1)//V def modf1(N,MOD):return (N-1)%MOD+1 inf = int(1e18+20) mod = int(1e9+7) def seg_insu(x,M): return insu(x,M)-insu(x-k,M) def insu(x,M): ans = 0 now = M while now <= x: ans += x//now now *= M return ans def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[]: arr.append([n, 1]) return arr n,k,m = mp() mfact = factorization(m) #print(mfact) ans = 0 bl = len(mfact) u = [] for i,j in mfact: u.append((seg_insu(n,i)-seg_insu(k,i))//j) print(min(u)) # for i in range(1,1<<bl): # tar = [] # cnt = 1 # for j in range(bl): # if bitA(i,j): # cnt += mfact[j][0]**mfact[j][1] # tar.append(mfact[j]) # bunsi = [] # bunbo = [] # y = [] # y.append(cnt) # u = inf # v = inf # for num,f in tar: # u = min(u,seg_insu()) # now = inf # for num, f in tar: # now = min(now, (seg_insu(n,num)-seg_insu(k,num))//f) # if len(tar) % 2 == 1: # ans += now # else: # ans -= now # print(ans,tar) #print(ans)