結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-11-25 19:54:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,110 bytes |
| コンパイル時間 | 374 ms |
| コンパイル使用メモリ | 55,620 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-01 05:09:30 |
| 合計ジャッジ時間 | 1,214 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <iostream>
using namespace std;
int min(int n[]){
int i,m=1000;
for(i=0;n[i];i++) if(n[i]<m)m=n[i];
return (m==1000?-1:m);
}
int main(){
int i=0,a=0,n=0,che=1,cnt[1000]={},result;
char c[1000];
bool cw=false,w=false,cheSrt=false,mybusiness=true;
cin>>c;
for(i=0;i<1000;i++){
if(c[i]<97||122<c[i]) break;
if(cw){
if(c[i]=='w'){
if(w){
cnt[a]=che;
if(cnt[a]==3)break;
che=1;
a++;
w=false;
if(n){i=n;n=0;mybusiness=true;}else{cw=false;cheSrt=false;}
}else{
w=true;
}
}else if(c[i]=='c'&&mybusiness){
if(w){
n=i;
mybusiness=false;
}else{
che=1;
}
}
}else if(c[i]=='c'){
cw=true;
cheSrt=true;
}
if(cheSrt)che++;
}
result=min(cnt);
cout<<result<<"\n";
return 0;
}