結果

問題 No.491 10^9+1と回文
コンテスト
ユーザー titia
提出日時 2023-06-15 04:01:06
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 352 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 346 ms
コンパイル使用メモリ 20,828 KB
実行使用メモリ 39,204 KB
最終ジャッジ日時 2026-03-07 23:09:56
合計ジャッジ時間 213,744 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample TLE * 3
other TLE * 103
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input = sys.stdin.readline

n=int(input())
count=0
for i in range(10**6+1):
    S=str(i)
    T=S+S[::-1]
    U=S+S[:-1][::-1]

    ANS=T+(9-len(T))*"0"+T[::-1]

    if 1<=int(ANS)<=n and int(ANS)%(10**9+1)==0:
        count+=1

    ANS=U+(9-len(U))*"0"+U[::-1]

    if 1<=int(ANS)<=n and int(ANS)%(10**9+1)==0:
        count+=1

print(count)
0