結果
| 問題 | No.436 ccw |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-29 16:49:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 428 bytes |
| コンパイル時間 | 477 ms |
| コンパイル使用メモリ | 64,476 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-30 08:02:01 |
| 合計ジャッジ時間 | 1,291 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
string S;
cin>>S;
int cNum=0;
int wNum=0;
int i;
for (i=0;i<S.length();i++){
if (S[i]=='c'){
cNum++;
}else{
wNum++;
}
}
if (cNum<=1 || wNum==0){
cout<<0<<endl;
return 0;
}
if (cNum==wNum){
cout<<cNum-1<<endl;
return 0;
}
if (cNum<wNum){
cout<<cNum-1<<endl;
}else{
cout<<wNum<<endl;
}
return 0;
}