結果

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <cmath>
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') ans = min(ans,k - i);
   cout << ans << endl;
}
0