結果
| 問題 |
No.559 swapAB列
|
| コンテスト | |
| ユーザー |
Elk
|
| 提出日時 | 2018-06-10 01:33:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 618 bytes |
| コンパイル時間 | 347 ms |
| コンパイル使用メモリ | 31,360 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-30 13:08:46 |
| 合計ジャッジ時間 | 786 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 WA * 3 |
ソースコード
#include <stdio.h>
#include <string.h>
int main(){
char str[13];
int i, len, state = 0, cnt = 0, cnt_B = 0;
scanf("%s", str);
len = strlen(str);
for(i = 0; i < len; i++){
if(state == 0){
if(str[i] == 'B'){
state = 1;
cnt_B++;
continue;
}
}else if(state == 1){
if(str[i] == 'A'){
cnt += cnt_B;
cnt_B = 1;
continue;
}else if(str[i] == 'B'){
cnt_B++;
}
}
}
printf("%d\n", cnt);
return 0;
}
Elk