結果
| 問題 |
No.672 最長AB列
|
| コンテスト | |
| ユーザー |
かぼちゃ
|
| 提出日時 | 2018-04-13 23:03:38 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 705 bytes |
| コンパイル時間 | 645 ms |
| コンパイル使用メモリ | 64,464 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-06-27 16:32:21 |
| 合計ジャッジ時間 | 4,198 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 TLE * 1 -- * 9 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:32:13: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
32 | cout << ans << endl;
| ^~~
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define REP(i,a,n) for(int i = (a);i < (n);i++)
#define PI 3.14159265359
#define MOD 1000000007
using namespace std;
int main(){
string s;
cin >> s;
int ans;
for(int h = s.length();h > 0;h--){
for(int j = 0;j < s.length()-h+1;j++){
int a = 0,b = 0;
for(int i = 0;i < h;i++){
if(s[j+i] == 'A')a++;
else b++;
}
if(a == b){
ans = h;
goto end;
}
}
}
end:
cout << ans << endl;
return 0;
}
かぼちゃ