結果
問題 |
No.3089 Base M Numbers, But Only 0~9
|
ユーザー |
![]() |
提出日時 | 2025-04-04 23:04:34 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 280 bytes |
コンパイル時間 | 321 ms |
コンパイル使用メモリ | 82,360 KB |
実行使用メモリ | 91,648 KB |
最終ジャッジ日時 | 2025-04-04 23:04:46 |
合計ジャッジ時間 | 10,656 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 13 WA * 6 |
ソースコード
M=998244353 m=int(input()) n=list(map(int,input()))[::-1] while len(n)-1>0 and n[-1]==0: n.pop() p=1 for d in n: c=(m-1-d)//10+1 p*=c p%=M a=0 for i in range(len(n)): d=n[i] c=(m-1-d)//10+1 a+=(((c-1)*c*pow(2,M-2,M))*10+d*c)*p*pow(c,M-2,M)*pow(m,i,M) a%=M print(a)