結果

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

ソースコード

diff #
raw source code

import sys
input = sys.stdin.readline

n=int(input())
count=0
for i in range(10**5+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