結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー alpha_virginis
提出日時 2015-05-08 22:29:33
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 554 bytes
コンパイル時間 1,432 ms
コンパイル使用メモリ 158,680 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-13 11:28:09
合計ジャッジ時間 2,772 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int main() {

  std::string str1, str2;
  char str[32];
  int ans = 0;
  int d;

  std::cin >> d;
  std::cin >> str1 >> str2;
  str1 += str2;


  for(int k = 0; k < 14-d; ++k) {
    strcpy(str, str1.c_str());
    for(int i = k; i < k+d; ++i) {
      str[i] = 'o';
    }
    for(int i = 0; i < 14; ++i) {
      if( str[i] == 'o' ) {
	for(int j = i+1; j <= 14; ++j) {
	  if( str[i] != str[j] ) {
	    ans = std::max(ans, j-i);
	    i = j-1;
	    break;
	  }
	}
      }
    }


  }

  std::cout << ans << std::endl;

  return 0;
}
0