結果

問題 No.345 最小チワワ問題
ユーザー ldsyb
提出日時 2016-02-27 18:42:58
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 511 bytes
コンパイル時間 602 ms
コンパイル使用メモリ 57,228 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-24 11:44:08
合計ジャッジ時間 1,436 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 12 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
   int ans = -1;
   string s;
   cin >> s;
   for(int i = 0;i < s.size();i++){
      if(s[i] == 'c'){
         for(int j = i + 1;j < s.size();j++){
            if(s[j] == 'w'){
               for(int k = j + 1;k < s.size();k++){
                  if(s[k] == 'w'){
                     cout << k - i << endl;
                     return 0;
                  }
               }
            }
         }
      }
   }
   cout << -1 << endl;
}
0