結果
| 問題 |
No.3089 Base M Numbers, But Only 0~9
|
| コンテスト | |
| ユーザー |
Iroha_3856
|
| 提出日時 | 2025-04-04 21:36:47 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 561 bytes |
| コンパイル時間 | 274 ms |
| コンパイル使用メモリ | 82,040 KB |
| 実行使用メモリ | 111,888 KB |
| 最終ジャッジ日時 | 2025-04-04 21:39:02 |
| 合計ジャッジ時間 | 3,991 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | TLE * 1 -- * 18 |
ソースコード
M = int(input())
N = input()
now, mod = 1, 998244353
ans = 0
mul = 1
F = []
for i in range(len(N)):
t = ord(N[len(N)-i-1])-ord('0')
#t, t+10, ... < M
x = ((M-1)-t)//10
cnt = x+1
first = t
last = (first + (cnt-1) * 10)%mod
# print(first, last, cnt)
s = (first + last) * cnt // 2 % mod
F.append((s*now%mod, cnt))
now = now * M % mod
S = []
nnow = 1
for i in range(len(N)):
S.append(nnow)
nnow *= F[i][1]
nnow %= mod
nnow = 1
for i in reversed(range(len(N))):
ans += F[i][0] * nnow % mod * S[i] % mod
ans %= mod
nnow *= F[i][1]
print(ans%mod)
Iroha_3856