結果
| 問題 | No.3304 INCREASE decrease | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-10-07 14:37:03 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 662 ms / 2,000 ms | 
| コード長 | 361 bytes | 
| コンパイル時間 | 4,220 ms | 
| コンパイル使用メモリ | 82,564 KB | 
| 実行使用メモリ | 80,368 KB | 
| 最終ジャッジ日時 | 2025-10-07 14:37:24 | 
| 合計ジャッジ時間 | 16,886 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 30 | 
ソースコード
def count(st):
    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)
            
            
            
        