結果

問題 No.491 10^9+1と回文
ユーザー nebukuro09
提出日時 2017-03-11 01:05:30
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 341 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-24 09:25:59
合計ジャッジ時間 26,818 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 23 WA * 80
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

N = input()

if (N < 10**9):
    print 0
    exit()

ans = 0

for p in itertools.product('0123456789', repeat=5):
    p = int(''.join(p))
    q = str(p)[::-1]
    if len(str(p)) % 2 == 1:
        q = q[1:]
    nnn = int(str(p) + str(q))
    nnn = nnn*10**9 + nnn
    if int(nnn) <= N:
        ans += 1

print max(0, ans-1)
0