結果
問題 |
No.38 赤青白ブロック
|
ユーザー |
![]() |
提出日時 | 2015-06-21 11:51:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 558 bytes |
コンパイル時間 | 1,300 ms |
コンパイル使用メモリ | 157,796 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-07 15:39:46 |
合計ジャッジ時間 | 1,965 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 WA * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:10:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%s", str); | ~~~~~^~~~~~~~~~~
ソースコード
#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; }