結果

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

ソースコード

diff #

#include <iostream>
#include <string>

using namespace std;

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