結果
| 問題 |
No.3089 Base M Numbers, But Only 0~9
|
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2025-04-05 14:26:21 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 408 bytes |
| コンパイル時間 | 391 ms |
| コンパイル使用メモリ | 82,672 KB |
| 実行使用メモリ | 76,676 KB |
| 最終ジャッジ日時 | 2025-04-05 14:26:25 |
| 合計ジャッジ時間 | 3,111 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 13 WA * 6 |
ソースコード
M = int(input())
N = input()
def RSUM(l, r, c):
return (l+r)*c//2
MOD = 998244353
ans = 0
C = M//10
cnt = 1
for i in range(len(N)):
ans *= M
ans %= MOD
c = C
if int(N[i]) <= M%10-1:
c += 1
ans *= c
ans %= MOD
l = int(N[i])
diff = ((M%10-1)-int(N[i]))%10
r = M-diff-1
ans += RSUM(l, r, c)%MOD*cnt%MOD
ans %= MOD
cnt *= c
cnt %= MOD
print(ans)
detteiuu