結果
問題 | No.2818 A Game I Play to Pass the Time |
ユーザー | highlighter |
提出日時 | 2024-04-27 00:06:47 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,243 ms / 2,000 ms |
コード長 | 759 bytes |
コンパイル時間 | 528 ms |
コンパイル使用メモリ | 82,108 KB |
実行使用メモリ | 78,212 KB |
最終ジャッジ日時 | 2024-04-27 00:07:25 |
合計ジャッジ時間 | 36,841 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
52,096 KB |
testcase_01 | AC | 1,179 ms
77,072 KB |
testcase_02 | AC | 1,218 ms
76,768 KB |
testcase_03 | AC | 1,243 ms
76,852 KB |
testcase_04 | AC | 1,216 ms
77,096 KB |
testcase_05 | AC | 1,175 ms
76,948 KB |
testcase_06 | AC | 1,202 ms
77,264 KB |
testcase_07 | AC | 1,145 ms
77,084 KB |
testcase_08 | AC | 1,210 ms
77,356 KB |
testcase_09 | AC | 1,191 ms
77,712 KB |
testcase_10 | AC | 1,204 ms
78,212 KB |
testcase_11 | AC | 932 ms
77,116 KB |
testcase_12 | AC | 637 ms
76,772 KB |
testcase_13 | AC | 850 ms
77,400 KB |
testcase_14 | AC | 1,062 ms
77,340 KB |
testcase_15 | AC | 944 ms
77,064 KB |
testcase_16 | AC | 1,034 ms
77,132 KB |
testcase_17 | AC | 897 ms
77,020 KB |
testcase_18 | AC | 921 ms
76,916 KB |
testcase_19 | AC | 1,121 ms
76,940 KB |
testcase_20 | AC | 1,101 ms
77,008 KB |
testcase_21 | AC | 1,104 ms
77,156 KB |
testcase_22 | AC | 822 ms
76,416 KB |
testcase_23 | AC | 758 ms
76,800 KB |
testcase_24 | AC | 827 ms
76,808 KB |
testcase_25 | AC | 775 ms
76,544 KB |
testcase_26 | AC | 1,066 ms
76,596 KB |
testcase_27 | AC | 1,106 ms
77,036 KB |
testcase_28 | AC | 954 ms
76,812 KB |
testcase_29 | AC | 968 ms
77,068 KB |
testcase_30 | AC | 1,002 ms
77,584 KB |
ソースコード
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] def factorize(N,M): 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 M,Q=map(int,input().split()) 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,input().split()) vec=factorize(N,M) 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)