結果
問題 | No.204 ゴールデン・ウィーク(2) |
ユーザー |
|
提出日時 | 2015-05-09 00:04:20 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 888 bytes |
コンパイル時間 | 1,511 ms |
コンパイル使用メモリ | 160,088 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 11:41:25 |
合計ジャッジ時間 | 2,911 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | int d; scanf("%d", &d); | ~~~~~^~~~~~~~~~
ソースコード
// (;ω;)<柔軟な発送が足りなかった… #include <bits/stdc++.h> using namespace std; class range {private: struct I{int x;int operator*(){return x;}bool operator!=(I& lhs){return x<lhs.x;}void operator++(){++x;}};I i,n; public:range(int n):i({0}),n({n}){}range(int i,int n):i({i}),n({n}){}I& begin(){return i;}I& end(){return n;}}; int main(void) { int d; scanf("%d", &d); string s1, s2; cin >> s1 >> s2; string s; for(int i : range(14)) { s += "x"; } s += s1 + s2; for(int i : range(14)) { s += "x"; } int ha = 0; for(int i : range(s.size()-d+1)) { string cp = s; for(int j : range(i, i+d)) { if(cp[j] == 'x') { cp[j] = 'o'; } else { break; } } int cnt = 0; for(int k : range(s.size())) { if(cp[k] == 'o') { cnt += 1; } else { cnt = 0; } ha = max(ha, cnt); } } printf("%d\n", ha); return 0; }