結果

問題 No.436 ccw
ユーザー atkrymatkrym
提出日時 2016-10-30 11:58:59
言語 Java19
(openjdk 21)
結果
AC  
実行時間 195 ms / 2,000 ms
コード長 438 bytes
コンパイル時間 2,125 ms
コンパイル使用メモリ 71,676 KB
実行使用メモリ 56,932 KB
最終ジャッジ日時 2023-08-16 11:16:06
合計ジャッジ時間 6,783 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,804 KB
testcase_01 AC 118 ms
55,772 KB
testcase_02 AC 116 ms
55,508 KB
testcase_03 AC 117 ms
55,800 KB
testcase_04 AC 117 ms
55,732 KB
testcase_05 AC 116 ms
55,828 KB
testcase_06 AC 117 ms
55,688 KB
testcase_07 AC 119 ms
56,096 KB
testcase_08 AC 118 ms
55,720 KB
testcase_09 AC 119 ms
55,532 KB
testcase_10 AC 118 ms
55,844 KB
testcase_11 AC 116 ms
55,628 KB
testcase_12 AC 118 ms
55,668 KB
testcase_13 AC 120 ms
55,536 KB
testcase_14 AC 120 ms
55,832 KB
testcase_15 AC 118 ms
55,472 KB
testcase_16 AC 130 ms
56,244 KB
testcase_17 AC 124 ms
55,716 KB
testcase_18 AC 131 ms
55,928 KB
testcase_19 AC 130 ms
55,804 KB
testcase_20 AC 130 ms
55,760 KB
testcase_21 AC 195 ms
56,220 KB
testcase_22 AC 188 ms
56,352 KB
testcase_23 AC 192 ms
56,004 KB
testcase_24 AC 189 ms
56,932 KB
testcase_25 AC 190 ms
56,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        String s = sc.next();
        int ret = 10000;
        int cnt = 0;
        for (int i = 0;i < s.length();i++) {
            if (s.charAt(i)=='c') cnt++;
        }
        ret = Math.min(cnt-1,s.length()-cnt);
        System.out.println(ret);
    }
}
0