結果
| 問題 |
No.672 最長AB列
|
| コンテスト | |
| ユーザー |
gt_ham_bass
|
| 提出日時 | 2018-04-13 23:23:31 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 483 bytes |
| コンパイル時間 | 1,574 ms |
| コンパイル使用メモリ | 56,796 KB |
| 実行使用メモリ | 5,504 KB |
| 最終ジャッジ日時 | 2024-06-27 19:49:31 |
| 合計ジャッジ時間 | 7,621 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 1 WA * 5 OLE * 2 -- * 8 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int ans,ANS,f_ans;
string s,S;
int main() {
std::cin >> s;
int n = s.size();
for(int i = 0; i < n; i++){
for(int j = 1; i + j < n; j++){
S = s.substr(i,j);
std::cout << S << std::endl;
ANS = 0;
for(int k = 0; k < j;k++){
if(S[k] == 'A') ANS++;
else if(S[k] == 'B') ANS--;
}
std::cout << ANS << std::endl;
if(ANS == 0) ans = std::max(ans,j);
}
}
std::cout << ans << std::endl;
}
gt_ham_bass