結果

問題 No.491 10^9+1と回文
ユーザー yumechi
提出日時 2017-03-10 22:55:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 632 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2024-06-24 08:30:03
合計ジャッジ時間 6,802 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 42 WA * 61
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n = int(input())
    ans = 0
    num = 10 ** 9 + 1
    for i in range(len(str(n // (10 ** 9)))):
        for j in range(1, 10):
            comp_num_str = str(num * int(str(j) * (i + 1)))
            lotation_flag = True
            for k in range(len(comp_num_str) // 2):
                if comp_num_str[k] != comp_num_str[-k-1]:
                    lotation_flag = False
                    break
            if not lotation_flag:
                continue
            if int(comp_num_str) <= n:
                ans += 1
            else:
                break
    print(ans)

if __name__=="__main__":
    solve()
0