結果
問題 |
No.491 10^9+1と回文
|
ユーザー |
|
提出日時 | 2022-04-16 18:15:25 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 548 bytes |
コンパイル時間 | 283 ms |
コンパイル使用メモリ | 81,792 KB |
実行使用メモリ | 76,160 KB |
最終ジャッジ日時 | 2024-12-25 21:56:45 |
合計ジャッジ時間 | 9,839 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | AC * 11 WA * 74 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 = 0 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)