結果

問題 No.38 赤青白ブロック
ユーザー alpha_virginisalpha_virginis
提出日時 2015-06-21 11:51:28
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 558 bytes
コンパイル時間 1,086 ms
コンパイル使用メモリ 144,152 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-21 22:32:23
合計ジャッジ時間 2,538 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 1 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 1 ms
4,376 KB
testcase_22 WA -
testcase_23 AC 1 ms
4,380 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int main() {

  long Kr, Kb;
  char str[32];
  int size = 30;

  std::cin >> Kr >> Kb;
  scanf("%s", str);
  

  for(int i = 0; i < size; ++i) {
    if( str[i] == 'R' and  i+Kr < size ) {
      if( str[i+Kr] == 'R' ) {
	for(int j = i+Kr; j < size; ++j) {
	  str[j] = str[j+1];
	}
	i -= 1;
      }
    }
    else if( str[i] == 'B' and  i+Kb < size ) {
      if( str[i+Kb] == 'B' ) {
	for(int j = i+Kb; j < size; ++j) {
	  str[j] = str[j+1];
	}
	i -= 1;
      }
    }
  }

  
  std::cout << strlen(str) << std::endl;
  
  return 0;
}
0