結果
問題 |
No.491 10^9+1と回文
|
ユーザー |
|
提出日時 | 2022-04-16 18:17:00 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 556 bytes |
コンパイル時間 | 241 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 76,032 KB |
最終ジャッジ日時 | 2024-12-25 21:58:39 |
合計ジャッジ時間 | 9,456 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 85 MLE * 18 |
ソースコード
n = input().zfill(18) if len(n) == 19: n = "9" * 18 S = n[:9] T = n[9:] S = int(S) T = int(T) if T >= S: n = S else: n = S - 1 ans = min(n, 9) x = 1 while 1: br = False for i in range(x, 10 * x): i = str(i) z = i + i[::-1] if int(z) <= n: ans += 1 else: br = True for j in range(10): z = i + str(j) + i[::-1] if int(z) <= n: ans += 1 else: br = True x *= 10 if br: break print(ans)