結果
問題 | No.491 10^9+1と回文 |
ユーザー |
![]() |
提出日時 | 2022-06-15 23:22:30 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 240 ms / 1,000 ms |
コード長 | 510 bytes |
コンパイル時間 | 128 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-10-05 01:09:43 |
合計ジャッジ時間 | 6,211 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 103 |
ソースコード
from itertools import productN = int(input())l = len(str(N))s = [str(i) for i in range(10)]res = 0if l < 10:exit(print(0))for i in range(10, l+1):z = 18-inz = i-9c = 1 if nz%2==0 else 0cc = (nz+1)//2for v in product(s, repeat=cc):if v[0] == '0':continuevv = ''.join(v)V = vv+vv[::-1] if c == 1 else vv+vv[:-1][::-1]# print(V)if int(V+'0'*z+V) <= N:# print(int(V+'0'*z+V))res += 1print(res)