結果
問題 | No.204 ゴールデン・ウィーク(2) |
ユーザー |
![]() |
提出日時 | 2015-11-11 01:59:30 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 553 bytes |
コンパイル時間 | 585 ms |
コンパイル使用メモリ | 60,644 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 11:49:10 |
合計ジャッジ時間 | 1,952 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
#include <iostream> #include <algorithm> #include <sstream> using namespace std; int main(int argc, char *argv[]) { int D; cin >> D; string a, b; cin >> a >> b; string c = string(D, 'x') + a + b + string(D, 'x'); int ans = 0; for (int i = 0; i != c.length(); ++i) { int r = D; int h = 0; for (int j = 0; j != c.length(); ++j) { if (c[j] == 'o') { ++h; if (j >= i) { r = 0; } } else if (j >= i && r > 0) { --r; ++h; } else { h = 0; } ans = max(ans, h); } } cout << ans << endl; return 0; }