結果
| 問題 |
No.3304 INCREASE decrease
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-10-05 14:37:43 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 679 ms / 2,000 ms |
| コード長 | 392 bytes |
| コンパイル時間 | 183 ms |
| コンパイル使用メモリ | 82,292 KB |
| 実行使用メモリ | 81,172 KB |
| 最終ジャッジ日時 | 2025-10-05 14:38:00 |
| 合計ジャッジ時間 | 15,468 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 30 |
ソースコード
def count(st):
if st<=0:
return 0
if st%2==1:
return count(st-1)+st//2
sm=st*(st+1)//2
sm-=st//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)