結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
kongarishisyamo
|
| 提出日時 | 2016-02-27 03:07:10 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 425 bytes |
| コンパイル時間 | 519 ms |
| コンパイル使用メモリ | 55,276 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-25 11:28:32 |
| 合計ジャッジ時間 | 1,411 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include<iostream>
#include<string>
using namespace std;
#define INF 100000
int main(){
string s;
int ans=INF;
cin>>s;
for(int i=0;i<s.size();i++){
if(s[i]=='c'){
for(int j=i+1;j<s.size();j++){
if(s[j]=='w'){
for(int k=j+1;k<s.size();k++){
if(s[k]=='w'){
if(ans>k-i+1){
ans=k-i+1;
}
}
}
}
}
}
}
if(ans!=INF) cout<<ans<<endl;
else cout<<"-1"<<endl;
}
kongarishisyamo