結果
問題 | No.2818 A Game I Play to Pass the Time |
ユーザー | highlighter |
提出日時 | 2024-04-27 11:59:02 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 831 ms / 2,000 ms |
コード長 | 795 bytes |
コンパイル時間 | 184 ms |
コンパイル使用メモリ | 81,968 KB |
実行使用メモリ | 79,588 KB |
最終ジャッジ日時 | 2024-04-27 11:59:32 |
合計ジャッジ時間 | 26,557 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 35 ms
52,324 KB |
testcase_01 | AC | 752 ms
79,588 KB |
testcase_02 | AC | 831 ms
78,840 KB |
testcase_03 | AC | 701 ms
79,272 KB |
testcase_04 | AC | 709 ms
79,288 KB |
testcase_05 | AC | 678 ms
79,388 KB |
testcase_06 | AC | 715 ms
79,052 KB |
testcase_07 | AC | 707 ms
79,016 KB |
testcase_08 | AC | 671 ms
78,728 KB |
testcase_09 | AC | 686 ms
78,852 KB |
testcase_10 | AC | 679 ms
79,144 KB |
testcase_11 | AC | 531 ms
78,180 KB |
testcase_12 | AC | 437 ms
78,356 KB |
testcase_13 | AC | 482 ms
78,836 KB |
testcase_14 | AC | 601 ms
78,720 KB |
testcase_15 | AC | 556 ms
78,360 KB |
testcase_16 | AC | 583 ms
78,780 KB |
testcase_17 | AC | 508 ms
78,424 KB |
testcase_18 | AC | 516 ms
78,780 KB |
testcase_19 | AC | 633 ms
78,928 KB |
testcase_20 | AC | 577 ms
78,332 KB |
testcase_21 | AC | 638 ms
78,480 KB |
testcase_22 | AC | 468 ms
78,168 KB |
testcase_23 | AC | 466 ms
77,732 KB |
testcase_24 | AC | 460 ms
77,904 KB |
testcase_25 | AC | 449 ms
77,824 KB |
testcase_26 | AC | 606 ms
79,188 KB |
testcase_27 | AC | 654 ms
78,568 KB |
testcase_28 | AC | 604 ms
78,412 KB |
testcase_29 | AC | 575 ms
78,644 KB |
testcase_30 | AC | 557 ms
78,628 KB |
ソースコード
from sys import stdin prime=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97] M,Q=map(int,stdin.readline().split()) def factorize(N): vec=[] for i in range(0,M): if N%prime[i]!=0: continue count=0 while N%prime[i]==0: N//=prime[i] count+=1 vec.append((prime[i],count)) return vec mod=998244353 inv=[0]*61 inv[1]=1 for i in range(2,61): inv[i]=mod-inv[mod%i]*(mod//i)%mod for i in range(Q): N,S=map(int,stdin.readline().split()) vec=factorize(N) ans=1 for p in vec: data=[0]*(p[1]+1) data[0]=1 for j in range(1,p[1]+1): data[j]=data[j-1]*p[0]%mod res=data[p[1]] mem=1 for j in range(1,p[1]+1): mem*=(S-2+j)%mod*inv[j]%mod mem%=mod res+=data[p[1]-j]*mem%mod res%=mod ans*=res ans%=mod ans*=S%mod ans%=mod print(ans)