結果
| 問題 |
No.3304 INCREASE decrease
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-10-07 14:37:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 461 ms / 2,000 ms |
| コード長 | 308 bytes |
| コンパイル時間 | 533 ms |
| コンパイル使用メモリ | 82,212 KB |
| 実行使用メモリ | 78,204 KB |
| 最終ジャッジ日時 | 2025-10-07 14:37:48 |
| 合計ジャッジ時間 | 11,764 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 30 |
ソースコード
def count(st):
sm=st*(st+1)//2-(st+1)//2
return sm//2
T=int(input())
for _ in range(T):
N,K=map(int,input().split())
N-=1
nt=N//pow(10,K)
nb=N%pow(10,K)
ans=count(nt-1)*count(pow(10,K)-1)
ls=nt//2
ls*=count(pow(10,K)-1)-count(pow(10,K)-2-nb)
print((ans+ls)%998244353)