提出 #67560919
ソースコード 拡げる
A = int(input())
N = int(input())
ans = 0
def to_base(n, b):
digits = []
while n:
digit = n % b
digits.append(digit)
n //= b
return digits == digits[::-1]
for j in range(10):
if j <= N and to_base(j, A):
ans += j
for i in range(1,99999):
for j in range(10):
compound = int(str(i) + str(j) + str(i)[::-1])
if compound <= N and to_base(compound, A):
ans += compound
for i in range(1, 999999):
compound = int(str(i) + str(i)[::-1])
if compound <= N and to_base(compound, A):
ans += compound
print(ans)
提出情報
| 提出日時 | |
|---|---|
| 問題 | C - Palindromic in Both Bases |
| ユーザ | L1bra |
| 言語 | Python (Cython 0.29.34) |
| 得点 | 0 |
| コード長 | 634 Byte |
| 結果 | TLE |
| 実行時間 | 3311 ms |
| メモリ | 9080 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 350 | ||||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt |
| All | 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00-sample-01.txt | AC | 953 ms | 9000 KiB |
| 00-sample-02.txt | AC | 2360 ms | 8940 KiB |
| 00-sample-03.txt | AC | 2484 ms | 8968 KiB |
| 01-01.txt | AC | 951 ms | 9004 KiB |
| 01-02.txt | AC | 958 ms | 9008 KiB |
| 01-03.txt | TLE | 3311 ms | 8940 KiB |
| 01-04.txt | AC | 2737 ms | 8968 KiB |
| 01-05.txt | AC | 2340 ms | 9080 KiB |
| 01-06.txt | AC | 2568 ms | 9020 KiB |
| 01-07.txt | AC | 2395 ms | 8936 KiB |
| 01-08.txt | AC | 2301 ms | 9000 KiB |
| 01-09.txt | TLE | 3116 ms | 9000 KiB |
| 01-10.txt | AC | 2540 ms | 8940 KiB |
| 01-11.txt | AC | 965 ms | 8940 KiB |
| 01-12.txt | AC | 1023 ms | 9040 KiB |
| 01-13.txt | AC | 956 ms | 8976 KiB |
| 01-14.txt | AC | 1020 ms | 9080 KiB |
| 01-15.txt | AC | 955 ms | 9016 KiB |
| 01-16.txt | AC | 961 ms | 9020 KiB |
| 01-17.txt | AC | 981 ms | 8940 KiB |
| 01-18.txt | AC | 965 ms | 9072 KiB |
| 01-19.txt | AC | 2978 ms | 8936 KiB |
| 01-20.txt | AC | 946 ms | 9072 KiB |
| 01-21.txt | AC | 962 ms | 8928 KiB |
| 01-22.txt | AC | 951 ms | 8940 KiB |
| 01-23.txt | AC | 953 ms | 8928 KiB |
| 01-24.txt | AC | 961 ms | 9000 KiB |
| 01-25.txt | AC | 971 ms | 9016 KiB |
| 01-26.txt | AC | 962 ms | 9044 KiB |
| 01-27.txt | AC | 1014 ms | 9024 KiB |
| 01-28.txt | AC | 947 ms | 8972 KiB |
| 01-29.txt | AC | 959 ms | 9020 KiB |
| 01-30.txt | AC | 968 ms | 8936 KiB |