結果
| 問題 |
No.3264 岩井数
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-10 09:55:59 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 48 ms / 2,000 ms |
| コード長 | 427 bytes |
| コンパイル時間 | 945 ms |
| コンパイル使用メモリ | 82,000 KB |
| 実行使用メモリ | 70,584 KB |
| 最終ジャッジ日時 | 2025-09-10 09:56:05 |
| 合計ジャッジ時間 | 4,621 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 30 |
ソースコード
def is_iwi(x):
if x % 10 != 9:
return False
xx = str(x)[:-1]
return xx == xx[::-1]
Ns = input()
N = int(Ns)
L = len(Ns)
i = 10 ** L + 1
ans = N * i
assert is_iwi(ans)
if ans >= 10 ** 9:
print(ans)
exit()
s = 10 ** 9 // N
while True:
if N * s >= 10 ** 9 and N * s % 10 == 9:
break
s += 1
for i in range(s, s + 10 ** 10, 10):
if is_iwi(N * i):
print(N * i)
break