結果

問題 No.436 ccw
ユーザー bayashiko_rbayashiko_r
提出日時 2019-01-02 21:59:22
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 715 bytes
コンパイル時間 847 ms
コンパイル使用メモリ 63,168 KB
実行使用メモリ 24,672 KB
最終ジャッジ日時 2023-08-14 01:49:17
合計ジャッジ時間 3,418 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
20,604 KB
testcase_01 AC 50 ms
18,540 KB
testcase_02 AC 50 ms
20,576 KB
testcase_03 AC 50 ms
20,592 KB
testcase_04 AC 50 ms
20,588 KB
testcase_05 AC 50 ms
22,732 KB
testcase_06 AC 50 ms
20,560 KB
testcase_07 AC 50 ms
18,472 KB
testcase_08 AC 51 ms
20,584 KB
testcase_09 AC 50 ms
20,552 KB
testcase_10 AC 50 ms
20,596 KB
testcase_11 AC 51 ms
24,672 KB
testcase_12 AC 50 ms
22,588 KB
testcase_13 AC 50 ms
18,552 KB
testcase_14 AC 50 ms
20,480 KB
testcase_15 AC 51 ms
20,592 KB
testcase_16 AC 51 ms
20,592 KB
testcase_17 AC 51 ms
22,692 KB
testcase_18 AC 51 ms
20,608 KB
testcase_19 AC 51 ms
22,660 KB
testcase_20 AC 51 ms
20,588 KB
testcase_21 AC 52 ms
22,508 KB
testcase_22 AC 51 ms
20,520 KB
testcase_23 AC 50 ms
20,424 KB
testcase_24 AC 52 ms
20,480 KB
testcase_25 AC 52 ms
20,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;

class Program {
    static void Main(string[] args) {
        //入力
        string s = Console.ReadLine();

        //cの個数
        int num_c = 0;
        //wの個数
        int num_w = 0;
        foreach (char let in s) {
            if (let == 'c') {
                num_c++;
            } else if (let == 'w') {
                num_w++;
            }
        }

        //回答用変数
        int ans_left = 0;  //左から消したときの操作回数
        int ans_right = 0;  //右から消したときの操作回数

        //計算
        ans_left = num_c - 1;
        ans_right = num_w;

        //出力
        Console.WriteLine(Math.Min(ans_left, ans_right));

    }
}
0