結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
cande398
|
| 提出日時 | 2017-10-09 22:37:30 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 428 bytes |
| コンパイル時間 | 520 ms |
| コンパイル使用メモリ | 56,668 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-25 12:04:18 |
| 合計ジャッジ時間 | 1,375 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
int i, j, cou=0, w = 0, min = 200;
string str;
cin >> str;
for(i=0;i<str.length();i++){
if(str[i] == 'c'){
cou = 1;
w = 1;
for(j=i+1;j<str.length();j++){
if(str[j] == 'w')w++;
if(w>2)if(min>j-i+1)min = j-i+1;
}
}
}
if(min!=200)cout << min << endl;
else cout << "-1" << endl;
return 0;
}
cande398