結果
問題 | No.204 ゴールデン・ウィーク(2) |
ユーザー |
![]() |
提出日時 | 2015-05-09 14:24:34 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 902 bytes |
コンパイル時間 | 1,455 ms |
コンパイル使用メモリ | 157,668 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 11:43:56 |
合計ジャッジ時間 | 2,867 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef pair<int, int> pii; typedef long long ll; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define INF 1e9 int main(){ const int N =14*3; char days[N]; for(int i=0;i<N;i++) days[i] = 'x'; int D; cin >> D ; for(int i =0;i<14;i++) cin >> days[14+i] ; int l = 0; int ans = 0; for(l=0;l<N;l++){ int to_holiday = D; int count = 0; for(int i=l;i<N;i++){ if(days[i] == 'x') to_holiday--; if(days[i] == 'o' && to_holiday!=D) to_holiday=0; if(to_holiday<0) break; count++; } if(to_holiday>0) count += to_holiday; ans = max(ans,count); } cout << ans << endl; return 0; }