結果

問題 No.672 最長AB列
ユーザー matsukin1111matsukin1111
提出日時 2018-12-11 20:37:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 605 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 11,864 KB
実行使用メモリ 12,992 KB
最終ジャッジ日時 2023-10-23 20:45:37
合計ジャッジ時間 5,819 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,060 KB
testcase_01 AC 26 ms
10,008 KB
testcase_02 AC 27 ms
10,008 KB
testcase_03 AC 27 ms
10,008 KB
testcase_04 AC 27 ms
10,008 KB
testcase_05 AC 26 ms
10,008 KB
testcase_06 AC 26 ms
10,008 KB
testcase_07 AC 27 ms
10,008 KB
testcase_08 AC 27 ms
10,008 KB
testcase_09 AC 36 ms
11,676 KB
testcase_10 AC 52 ms
12,992 KB
testcase_11 AC 49 ms
12,992 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def count(a):
        global answer
        if (a.count('A') == a.count('B')):
                answer = 2*(a.count('A'))
                

        
def check(data):
        global answer
        for i in range(2*min,1,-1):
                for j in range(len(data)-i+1):
                        a = data[j:j+i]
                        count(a)
                        if(answer != 0):return
                        
                        
                        
answer = 0

data = list(input())
A = data.count("A")
B = data.count("B")
min = 0
if A >= B:min = B
else: min = A


check(data)
print(answer)
0