結果

問題 No.436 ccw
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-20 20:53:01
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 239 bytes
コンパイル時間 600 ms
コンパイル使用メモリ 71,664 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 06:27:51
合計ジャッジ時間 1,549 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
6,940 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 WA -
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 4 ms
6,944 KB
testcase_22 AC 3 ms
6,940 KB
testcase_23 AC 4 ms
6,944 KB
testcase_24 WA -
testcase_25 AC 4 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:11:22: warning: 'c' may be used uninitialized [-Wmaybe-uninitialized]
   11 |     if(s[i] == 'c') c++;
      |                     ~^~
main.cpp:8:7: note: 'c' was declared here
    8 |   int c;
      |       ^
main.cpp:12:22: warning: 'w' may be used uninitialized [-Wmaybe-uninitialized]
   12 |     if(s[i] == 'w') w++;
      |                     ~^~
main.cpp:9:7: note: 'w' was declared here
    9 |   int w;
      |       ^

ソースコード

diff #

#include <iostream>

using namespace std;
 
int main() {
  string s;
  cin >> s;
  int c;
  int w;
  for(int i = 0; i < s.length(); i++) {
    if(s[i] == 'c') c++;
    if(s[i] == 'w') w++;
  }
  cout << min(c - 1, w) << endl;
  return 0;
}
0