結果
問題 |
No.672 最長AB列
|
ユーザー |
![]() |
提出日時 | 2018-04-13 23:10:56 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 711 bytes |
コンパイル時間 | 497 ms |
コンパイル使用メモリ | 64,348 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-06-27 16:33:06 |
合計ジャッジ時間 | 4,111 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 3 WA * 3 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()/2;h > 0;h--){ for(int j = 0;j < s.length()-h+1;j++){ int a = 0,b = 0; for(int i = 0;i < h*2;i++){ if(s[j+i] == 'A')a++; else b++; } if(a == b){ ans = h*2; goto end; } } } end: cout << ans << endl; return 0; }