結果
| 問題 | No.436 ccw |
| コンテスト | |
| ユーザー |
ieneko18
|
| 提出日時 | 2016-10-29 13:33:53 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 514 bytes |
| 記録 | |
| コンパイル時間 | 663 ms |
| コンパイル使用メモリ | 98,036 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-18 19:29:09 |
| 合計ジャッジ時間 | 1,756 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 24 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:24:23: warning: 'w_num' may be used uninitialized [-Wmaybe-uninitialized]
24 | if(s[i]=='w')w_num++;
| ~~~~~^~
main.cpp:20:13: note: 'w_num' was declared here
20 | int c_num,w_num;
| ^~~~~
main.cpp:23:23: warning: 'c_num' may be used uninitialized [-Wmaybe-uninitialized]
23 | if(s[i]=='c')c_num++;
| ~~~~~^~
main.cpp:20:7: note: 'c_num' was declared here
20 | int c_num,w_num;
| ^~~~~
ソースコード
#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(unsigned int i=0;i<s.length();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;
}
ieneko18