結果

問題 No.672 最長AB列
ユーザー hang_hang_clnhang_hang_cln
提出日時 2018-05-07 21:26:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 384 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,652 KB
実行使用メモリ 15,096 KB
最終ジャッジ日時 2023-09-10 10:57:04
合計ジャッジ時間 4,776 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

S = input()
if len(S) < 2:
    print('0')
else:
    maxCutLength = 0
    for cutLength in range(2,len(S)+1):
        for startIndex in range(0,len(S)-cutLength):
            if S[startIndex:startIndex+cutLength].count('A') == S[startIndex:startIndex+cutLength].count('B'):
                if cutLength > maxCutLength:
                    maxCutLength = cutLength

print (maxCutLength)
0