結果

問題 No.436 ccw
ユーザー いろどり
提出日時 2017-03-01 18:52:54
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 337 bytes
コンパイル時間 414 ms
コンパイル使用メモリ 55,112 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-12 22:17:18
合計ジャッジ時間 2,003 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19 RE * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |     scanf("%s", s);
      |     ~~~~~^~~~~~~~~

ソースコード

diff #

// ccw
#include <iostream>
#include <cstdio>
using namespace std;

char s[10005] = {};
int count_c, count_w;

int main() {
    int i = 0;
    scanf("%s", s);
    while(i < 10000) {
        if(s[i] == 'c') count_c++;
        else if(s[i] == 'w') count_w++;
        i++;
    }
    cout << min(count_c - 1, count_w) << endl;
    return 0;
}
0