結果
| 問題 | No.3549 SigMax Digits (Judge ver.) |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2026-05-23 00:10:17 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 649 bytes |
| 記録 | |
| コンパイル時間 | 638 ms |
| コンパイル使用メモリ | 20,696 KB |
| 実行使用メモリ | 22,012 KB |
| 最終ジャッジ日時 | 2026-05-23 00:10:46 |
| 合計ジャッジ時間 | 11,452 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 TLE * 1 -- * 4 |
ソースコード
import sys
input = sys.stdin.readline
from functools import lru_cache
@lru_cache(maxsize=None)
def calc(N,m):
#print(N,m)
if N<=9:
ANS=0
for i in range(N+1):
ANS+=max(i,m)
return ANS
now=1
for i in range(1,20):
if N>=now:
keta=now
else:
break
now=now*10
ANS=0
x=N//keta
#print(keta,x)
for i in range(x):
ANS+=calc(keta-1,max(i,m))
ANS+=calc(N%keta,max(x,m))
return ANS
t=int(input())
for tests in range(t):
L,R=list(map(int,input().split()))
ANS=calc(R,0)-calc(L-1,0)
print(ANS)
titia