結果
| 問題 | No.3089 Base M Numbers, But Only 0~9 |
| コンテスト | |
| ユーザー |
nikoro256
|
| 提出日時 | 2025-04-04 22:23:03 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 487 bytes |
| 記録 | |
| コンパイル時間 | 464 ms |
| コンパイル使用メモリ | 96,228 KB |
| 実行使用メモリ | 310,912 KB |
| 最終ジャッジ日時 | 2026-07-08 10:28:38 |
| 合計ジャッジ時間 | 5,065 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | TLE * 1 -- * 18 |
ソースコード
M=int(input())
N=input()
p=998244353
l=len(N)
all_count = 1
for i in range(len(N)-1,-1,-1):
n = int(N[i])
count = (M-1-n)//10+1
all_count *= count
ans = 1
left = 1
for i in range(len(N)-1,-1,-1):
n = int(N[i])
count = (M-1-n)//10+1
tmp=0
tmp += (10*(count-1))*count//2
ans %= p
tmp += n*count
#print(tmp)
#print(all_count*pow(count,-1,p)%p)
ans+=tmp*left*all_count*pow(count,-1,p)
ans %= p
left *= M
left %= p
print((ans-1)%p)
nikoro256