結果
問題 | No.204 ゴールデン・ウィーク(2) |
ユーザー |
![]() |
提出日時 | 2015-05-08 22:49:57 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 694 bytes |
コンパイル時間 | 1,497 ms |
コンパイル使用メモリ | 159,884 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 11:36:54 |
合計ジャッジ時間 | 2,382 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
#include <bits/stdc++.h> int main() { std::string str1, str2, str3; char str[64]; int ans = 0; int d; std::cin >> d; std::cin >> str1 >> str2; str3 = "xxxxxxxxxxxxxx"; str3 += str1; str3 += str2; str3 += "xxxxxxxxxxxxxx"; for(int k = 0; k < 14*3; ++k) { strcpy(str, str3.c_str()); for(int i = k; i < k+d; ++i) { if( str[i] == 'x' ) { str[i] = 'o'; } else { break; } } for(int i = 0; i < 14*3; ++i) { if( str[i] == 'o' ) { for(int j = i+1; j <= 14*3; ++j) { if( str[i] != str[j] ) { ans = std::max(ans, j-i); i = j-1; break; } } } } } std::cout << ans << std::endl; return 0; }