結果
問題 |
No.559 swapAB列
|
ユーザー |
![]() |
提出日時 | 2018-06-10 01:35:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 591 bytes |
コンパイル時間 | 191 ms |
コンパイル使用メモリ | 31,488 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-30 13:08:48 |
合計ジャッジ時間 | 680 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
#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; continue; }else if(str[i] == 'B'){ cnt_B++; } } } printf("%d\n", cnt); return 0; }