結果

問題 No.491 10^9+1と回文
ユーザー ノットカワズノットカワズ
提出日時 2017-03-28 07:45:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 783 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 8,256 KB
最終ジャッジ日時 2023-09-20 18:02:35
合計ジャッジ時間 6,399 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 15 ms
7,852 KB
testcase_02 WA -
testcase_03 AC 25 ms
7,848 KB
testcase_04 AC 16 ms
7,912 KB
testcase_05 AC 23 ms
7,912 KB
testcase_06 AC 112 ms
7,788 KB
testcase_07 AC 17 ms
7,800 KB
testcase_08 AC 15 ms
7,956 KB
testcase_09 WA -
testcase_10 AC 15 ms
8,196 KB
testcase_11 AC 16 ms
7,764 KB
testcase_12 AC 16 ms
7,864 KB
testcase_13 AC 15 ms
8,248 KB
testcase_14 AC 16 ms
7,960 KB
testcase_15 AC 16 ms
7,808 KB
testcase_16 AC 16 ms
7,796 KB
testcase_17 AC 15 ms
7,800 KB
testcase_18 AC 16 ms
7,876 KB
testcase_19 AC 15 ms
7,764 KB
testcase_20 AC 15 ms
7,796 KB
testcase_21 AC 15 ms
7,904 KB
testcase_22 WA -
testcase_23 AC 16 ms
7,876 KB
testcase_24 WA -
testcase_25 AC 15 ms
7,796 KB
testcase_26 AC 15 ms
8,140 KB
testcase_27 AC 15 ms
7,800 KB
testcase_28 AC 16 ms
7,848 KB
testcase_29 WA -
testcase_30 AC 16 ms
7,804 KB
testcase_31 AC 16 ms
8,216 KB
testcase_32 AC 16 ms
7,856 KB
testcase_33 WA -
testcase_34 AC 15 ms
7,836 KB
testcase_35 AC 17 ms
7,768 KB
testcase_36 AC 16 ms
8,232 KB
testcase_37 AC 16 ms
7,768 KB
testcase_38 AC 15 ms
7,768 KB
testcase_39 AC 16 ms
7,792 KB
testcase_40 AC 16 ms
8,252 KB
testcase_41 AC 16 ms
7,856 KB
testcase_42 AC 16 ms
7,844 KB
testcase_43 AC 16 ms
7,836 KB
testcase_44 AC 16 ms
7,836 KB
testcase_45 AC 16 ms
7,856 KB
testcase_46 AC 16 ms
7,904 KB
testcase_47 AC 16 ms
7,848 KB
testcase_48 AC 16 ms
7,904 KB
testcase_49 AC 16 ms
8,248 KB
testcase_50 AC 16 ms
7,780 KB
testcase_51 AC 16 ms
7,792 KB
testcase_52 AC 16 ms
7,792 KB
testcase_53 AC 16 ms
8,220 KB
testcase_54 AC 16 ms
7,952 KB
testcase_55 AC 16 ms
7,840 KB
testcase_56 AC 16 ms
7,768 KB
testcase_57 AC 16 ms
7,800 KB
testcase_58 AC 17 ms
7,836 KB
testcase_59 AC 16 ms
7,764 KB
testcase_60 AC 16 ms
7,904 KB
testcase_61 WA -
testcase_62 AC 16 ms
7,772 KB
testcase_63 AC 16 ms
7,904 KB
testcase_64 AC 16 ms
7,804 KB
testcase_65 AC 16 ms
7,800 KB
testcase_66 AC 16 ms
7,840 KB
testcase_67 AC 25 ms
7,836 KB
testcase_68 AC 17 ms
7,796 KB
testcase_69 AC 16 ms
8,196 KB
testcase_70 AC 17 ms
7,856 KB
testcase_71 AC 17 ms
7,800 KB
testcase_72 AC 16 ms
7,800 KB
testcase_73 AC 16 ms
7,800 KB
testcase_74 AC 16 ms
7,856 KB
testcase_75 WA -
testcase_76 AC 16 ms
7,796 KB
testcase_77 AC 16 ms
7,844 KB
testcase_78 AC 16 ms
7,772 KB
testcase_79 AC 16 ms
7,800 KB
testcase_80 AC 16 ms
8,148 KB
testcase_81 WA -
testcase_82 AC 16 ms
7,900 KB
testcase_83 AC 16 ms
7,792 KB
testcase_84 WA -
testcase_85 AC 16 ms
7,852 KB
testcase_86 WA -
testcase_87 AC 16 ms
7,840 KB
testcase_88 AC 15 ms
8,256 KB
testcase_89 AC 16 ms
7,832 KB
testcase_90 AC 16 ms
7,804 KB
testcase_91 AC 16 ms
7,904 KB
testcase_92 WA -
testcase_93 AC 16 ms
7,904 KB
testcase_94 AC 17 ms
7,848 KB
testcase_95 WA -
testcase_96 AC 15 ms
7,808 KB
testcase_97 AC 86 ms
7,800 KB
testcase_98 AC 94 ms
7,780 KB
testcase_99 AC 90 ms
7,800 KB
testcase_100 WA -
testcase_101 AC 89 ms
7,904 KB
testcase_102 AC 90 ms
7,888 KB
testcase_103 AC 93 ms
7,848 KB
testcase_104 WA -
testcase_105 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

import sys


s = input()
if int(s) < 10 ** 9 + 1:
    print(0)
    sys.exit()

index = len(s)-9
total = 0
kaibunsu_dict = {
    0: 0,
    1: 9,
    2: 18,
    3: 108,
    4: 198,
    5: 1098,
    6: 1998,
    7: 10998,
    8: 19998,
    9: 109998
}
total += kaibunsu_dict[index-1]


def gen_palindromic(k, B, l=0):
    if l == k:
        yield 0
    elif l == k - 1:
        for d in range(B):
            yield d
    else:
        begin = 1 if l == 0 else 0
        m = B ** (k - l - 1) + 1
        for d in range(begin, B):
            for n in gen_palindromic(k, B, l + 2):
                yield n * B + d * m


left_numbers = s[:index]
for x in gen_palindromic(index, 10):
    if x <= int(left_numbers):
        total += 1
len(left_numbers)
print(total)
0