結果

問題 No.2234 palindromer
ユーザー chankei271828chankei271828
提出日時 2023-03-03 22:26:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 370 bytes
コンパイル時間 1,904 ms
コンパイル使用メモリ 81,696 KB
実行使用メモリ 59,972 KB
最終ジャッジ日時 2023-10-18 02:36:17
合計ジャッジ時間 1,645 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,524 KB
testcase_01 AC 38 ms
53,524 KB
testcase_02 AC 38 ms
53,524 KB
testcase_03 AC 38 ms
53,524 KB
testcase_04 AC 38 ms
53,524 KB
testcase_05 AC 38 ms
53,524 KB
testcase_06 AC 38 ms
53,524 KB
testcase_07 AC 38 ms
53,524 KB
testcase_08 AC 38 ms
53,524 KB
testcase_09 AC 39 ms
53,524 KB
testcase_10 AC 42 ms
59,628 KB
testcase_11 AC 44 ms
59,972 KB
testcase_12 AC 38 ms
53,524 KB
testcase_13 AC 37 ms
53,524 KB
testcase_14 AC 38 ms
53,524 KB
testcase_15 AC 37 ms
53,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(s):
    n=len(s)
    l=0
    r=n-1
    while r-l>=1:
        if s[l]!=s[r]:
            return False
        l+=1
        r-=1
    return True
A=input()
N=len(A)
for ans in range(N,2*N+1):
    now=[]
    for i in range(N):
        now.append(A[i])
    for j in range(ans-N):
        now.append(A[ans-N-j-1])
    if f(now):
        print(''.join(now))
        break
0