結果

問題 No.345 最小チワワ問題
ユーザー Elk
提出日時 2018-05-22 22:15:26
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 862 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 22,784 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-28 15:54:15
合計ジャッジ時間 1,017 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>

int main(int argc, char const *argv[]) {
    /* code */
    char str[256];
    int wp = 0;
    int flag = 0, cnt = 0;

    while(fscanf(stdin, "%c", &str[wp++]) != EOF){
        if(str[wp - 1] == 'c'){
            while(fscanf(stdin, "%c", &str[wp++]) != EOF){
                cnt++;
                if(str[wp - 1] == 'w'){
                    while(fscanf(stdin, "%c", &str[wp++]) != EOF){
                        cnt++;
                        if(str[wp - 1] == 'w'){
                            cnt++;
                            flag = 1;
                            break;
                        }
                    }
                    break;
                }
            }
            break;
        }
    }

    if(flag == 1){
        fprintf(stdout, "%d\n", cnt);
    }else{
        fprintf(stdout, "-1\n");
    }
    return 0;
}
0