結果
| 問題 |
No.491 10^9+1と回文
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-05-18 08:54:11 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 508 bytes |
| コンパイル時間 | 679 ms |
| コンパイル使用メモリ | 82,276 KB |
| 実行使用メモリ | 76,152 KB |
| 最終ジャッジ日時 | 2024-12-16 01:14:17 |
| 合計ジャッジ時間 | 6,597 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 90 MLE * 13 |
ソースコード
N = int(input())
ten = 10 ** 9
if N < ten + 1:
print(0)
exit()
a, b = N // ten, N % ten
if a > b:
a -= 1
ans = 0
M = 10**5 + 5
for i in range(1, M):
s = str(i)
n = int(s + s[::-1])
if n <= a:
ans += 1
else:
break
for m in range(10):
for i in range(M):
if i == 0:
s = ""
else:
s = str(i)
n = int(s + str(m) + s[::-1])
if n <= a:
ans += 1
else:
break
print(ans - 1)
rlangevin