結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
treeone
|
| 提出日時 | 2016-02-26 22:28:56 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 718 bytes |
| コンパイル時間 | 618 ms |
| コンパイル使用メモリ | 71,956 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-25 11:23:59 |
| 合計ジャッジ時間 | 1,650 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int main(){
string s;
cin>>s;
int MIN=1000,f=0,tmp=0;
rep(i,0,s.size()){
if(s[i]=='c'){
f=0;
tmp=0;
rep(j,i+1,s.size()){
if(s[j]=='w') f++;
if(f==2){
tmp=j-i+1;
MIN=min(MIN,tmp);
break;
}
}
}
}
o((MIN==1000?-1:MIN));
}
treeone