結果

問題 No.345 最小チワワ問題
ユーザー cande398
提出日時 2017-10-09 22:26:45
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 421 bytes
コンパイル時間 500 ms
コンパイル使用メモリ 56,624 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-17 07:07:59
合計ジャッジ時間 1,556 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

int main(void)
{
  int i, cou=0, w = 0, min = 200;
  string str;
  cin >> str;
  for(i=0;i<str.length();i++, cou++){
    if(str[i] == 'c'){
      cou = 1;
      w = 1;
    }
    if(str[i] == 'w' && w == 2){
      if(min>cou)min = cou;
    }
    if(str[i] == 'w' && w == 1)w = 2;
  }
  if(min!=200)cout << min << endl;
  else cout << "-1" << endl;
  return 0;
}
0