結果
問題 |
No.491 10^9+1と回文
|
ユーザー |
|
提出日時 | 2021-11-20 04:25:45 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 800 bytes |
コンパイル時間 | 199 ms |
コンパイル使用メモリ | 12,160 KB |
実行使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2025-01-02 12:18:12 |
合計ジャッジ時間 | 6,311 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 WA * 71 |
ソースコード
#!/usr/bin/env python3 # from typing import * import sys import io import math import collections import decimal import itertools import bisect import heapq def input(): return sys.stdin.readline()[:-1] # sys.setrecursionlimit(1000000) # _INPUT = """# paste here... # """ # sys.stdin = io.StringIO(_INPUT) INF = 10**10 MOD = 1000000007 def solve(N): if N < 10**9+1: return 0 N1 = N // (10**9) N2 = N % (10**9) d = len(str(N1)) ans = 0 for d1 in range(1, d): i = (d+1)//2 - 1 ans += 9 * (10 ** i) a = N1 // (10**(d//2)) ans += a-1 if d % 2 == 0: b = int(str(a) + str(a)[::-1]) else: b = int(str(a) + str(a)[:-1][::-1]) if b <= N2: ans += 1 return ans N = int(input()) print(solve(N))