結果
問題 | No.204 ゴールデン・ウィーク(2) |
ユーザー |
![]() |
提出日時 | 2015-07-26 16:18:04 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 766 bytes |
コンパイル時間 | 855 ms |
コンパイル使用メモリ | 79,012 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 11:48:35 |
合計ジャッジ時間 | 2,278 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
#include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <complex> #include <queue> #include <set> #include <map> using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) typedef long long ll; int main() { int D; cin >> D; char c[42]; rep(i, 42) c[i] = 'x'; REP(i, 14, 28) { cin >> c[i]; } int ans = 0; rep(i, 42) { int cnt1 = 0; for(int j=i-1; j>=0; j--) { if(c[j] == 'x') { break; } cnt1 ++; } int d = 0; REP(j, i, i+D) { if(c[j] == 'o') { break; } d++; } int cnt2 = 0; REP(j, i+d, 42) { if(c[j] == 'x') { break; } cnt2 ++; } ans = max(ans, cnt1 + cnt2 + d); } cout << ans << endl; return 0; }