結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-09 01:58:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 749 bytes |
| コンパイル時間 | 1,005 ms |
| コンパイル使用メモリ | 56,488 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-29 22:35:37 |
| 合計ジャッジ時間 | 1,494 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 WA * 6 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:9: warning: ‘count’ may be used uninitialized [-Wmaybe-uninitialized]
11 | if(count == 2) break;
| ^~
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main(){
string cww; cin >> cww;
int len = cww.size();
int count;
int temae;
for(int i = 0; i < len-2; i++){
if(count == 2) break;
count = 0;
if(cww[i] == 'c'){
for(int j = i+1; j < len; j++){
if(cww[j] == 'w'){
count += 1;
if(count == 1) temae = j;
if(count == 2){
for(int k = 0; k < temae ; k++) if(cww[k] == 'c') i = k;
cout << j - i + 1 << endl;
break;
}
}
}
}
}
if(count != 2) cout << -1 << endl;
return 0;
}