結果

問題 No.672 最長AB列
ユーザー syunsukesyunsuke
提出日時 2018-06-24 22:54:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 363 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 10,524 KB
実行使用メモリ 16,028 KB
最終ジャッジ日時 2023-09-13 13:48:15
合計ジャッジ時間 5,312 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 14 ms
7,756 KB
testcase_02 AC 15 ms
7,776 KB
testcase_03 AC 15 ms
7,772 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 16 ms
8,240 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input()
A=S.count("A")
B=S.count("B")
m=[A,B]
#print(min(m))
if min(m)==0:
    print(0)
else:
    for i in range(min(m)):
        
        for j in range(len(S)-2*min(m)+1+2*i):
            if len(S[j:j+2*min(m)-2*i])==2*S[j:j+2*min(m)-2*i].count("A"):
                print(len(S[j:j+2*min(m)-2*i]))
                break
            else:
                j+=1
0