結果
| 問題 | No.559 swapAB列 |
| コンテスト | |
| ユーザー |
Elk
|
| 提出日時 | 2018-06-10 01:33:45 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 618 bytes |
| 記録 | |
| コンパイル時間 | 348 ms |
| コンパイル使用メモリ | 40,880 KB |
| 実行使用メモリ | 7,840 KB |
| 最終ジャッジ日時 | 2026-03-20 13:07:08 |
| 合計ジャッジ時間 | 986 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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