結果
| 問題 |
No.436 ccw
|
| コンテスト | |
| ユーザー |
ieneko18
|
| 提出日時 | 2016-10-29 13:33:53 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 514 bytes |
| コンパイル時間 | 909 ms |
| コンパイル使用メモリ | 82,364 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-24 17:49:30 |
| 合計ジャッジ時間 | 1,733 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 15 WA * 9 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:20:13: warning: 'w_num' may be used uninitialized [-Wmaybe-uninitialized]
20 | int c_num,w_num;
| ^~~~~
main.cpp:26:20: warning: 'c_num' may be used uninitialized [-Wmaybe-uninitialized]
26 | int res=min(c_num-1,w_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