結果
問題 | No.204 ゴールデン・ウィーク(2) |
ユーザー |
|
提出日時 | 2015-06-08 20:42:10 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 452 bytes |
コンパイル時間 | 578 ms |
コンパイル使用メモリ | 58,464 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 13:20:52 |
合計ジャッジ時間 | 1,875 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 WA * 34 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:26:11: warning: ‘result’ may be used uninitialized in this function [-Wmaybe-uninitialized] 26 | cout << result << endl; | ^~~~~~
ソースコード
#include <iostream> #include <algorithm> using namespace std; int main(){ int d; cin >> d; string a, b; cin >> a >> b; string str = a + b; int count, result; for(int i = 1; i <= 14; i++){ for(int j = 0; j < 15 - i; j++){ count = 0; for(int k = 0; k < i; k++){ if(str[j + k] == 'x') count++; } if(count <= d){ result = i; break; } } } cout << result << endl; }