結果

問題 No.345 最小チワワ問題
ユーザー mell1mell1
提出日時 2018-11-25 19:54:28
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,110 bytes
コンパイル時間 433 ms
コンパイル使用メモリ 55,964 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-08 10:59:07
合計ジャッジ時間 1,387 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 1 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 1 ms
6,676 KB
testcase_10 AC 1 ms
6,676 KB
testcase_11 AC 1 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 1 ms
6,676 KB
testcase_15 AC 2 ms
6,676 KB
testcase_16 AC 1 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 1 ms
6,676 KB
testcase_19 AC 1 ms
6,676 KB
testcase_20 AC 1 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
testcase_23 AC 1 ms
6,676 KB
testcase_24 AC 1 ms
6,676 KB
testcase_25 AC 1 ms
6,676 KB
testcase_26 AC 2 ms
6,676 KB
testcase_27 AC 2 ms
6,676 KB
testcase_28 AC 2 ms
6,676 KB
testcase_29 AC 1 ms
6,676 KB
testcase_30 AC 2 ms
6,676 KB
testcase_31 AC 1 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0