結果
| 問題 |
No.2021 Not A but B
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-08-16 22:28:21 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 2,000 ms |
| コード長 | 427 bytes |
| コンパイル時間 | 2,028 ms |
| コンパイル使用メモリ | 188,180 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-03 16:04:11 |
| 合計ジャッジ時間 | 3,056 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
コンパイルメッセージ
main.cpp:2:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
2 | #import <bits/stdc++.h>
| ^~~~~~
ソースコード
#define _GLIBCXX_DEBUG
#import <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
typedef long long ll;
int main() {
int a;string s;cin>>a>>s;int res = a-1;int base = 0;
rep(i,a-1){
if(s[i]=='B'&&s[i+1]=='B'){res--;base = 1;}
}
rep(i,a-2){
if(s[i]=='B'&&s[i+1]=='A'&&s[i+2]=='B'){res--;}
}
cout << res+base << endl;
}