結果

問題 No.491 10^9+1と回文
ユーザー 👑 rin204
提出日時 2022-04-16 18:15:56
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 548 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-25 21:58:27
合計ジャッジ時間 7,950 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 11 WA * 91 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

n = input().zfill(18)
if len(n) == 19:
    n = "9" * 18
S = n[:9]
T = n[9:]
S = int(S)
T = int(T)
if T >= S:
    n = S
else:
    n = S - 1

ans = 0
x = 1
while 1:
    br = False
    for i in range(x, 10 * x):
        i = str(i)
        z = i + i[::-1]
        if int(z) <= n:
            ans += 1
        else:
            br = True
        for j in range(10):
            z = i + str(j) + i[::-1]
            if int(z) <= n:
                ans += 1
            else:
                br = True
    x *= 10
    if br:
        break

print(ans)
    
0