結果

問題 No.436 ccw
ユーザー ieneko18ieneko18
提出日時 2016-10-29 13:27:05
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 503 bytes
コンパイル時間 607 ms
コンパイル使用メモリ 73,212 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-03 15:44:19
合計ジャッジ時間 1,381 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 WA -
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 4 ms
5,376 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 3 ms
5,376 KB
testcase_24 WA -
testcase_25 AC 3 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:13: warning: ‘w_num’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   20 |   int c_num,w_num;
      |             ^~~~~
main.cpp:26:20: warning: ‘c_num’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   26 |   int res=min(c_num-1,w_num);
      |               ~~~~~^~

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
using namespace std;
#define MOD 1000000007
#define INF 999999999
typedef long long ll;

int tt[180][2];
int main(){
  string s;
  int c_num,w_num;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='c')c_num++;
    if(s[i]=='w')w_num++;
  }
  int res=min(c_num-1,w_num);
  cout<<res<<endl;
  return 0;
}
0