結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-06-08 20:46:56 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 618 bytes |
| コンパイル時間 | 498 ms |
| コンパイル使用メモリ | 58,620 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-13 13:20:54 |
| 合計ジャッジ時間 | 1,858 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 31 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:36:11: warning: ‘result’ may be used uninitialized in this function [-Wmaybe-uninitialized]
36 | 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 countx = 0;
for(int i = 0; i < 14; i++){
if(str[i] == 'x')
countx++;
}
if(countx <= d){
cout << 14 + d - countx << endl;
return 0;
}
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;
}