結果

問題 No.436 ccw
ユーザー atkrymatkrym
提出日時 2016-10-30 11:58:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 183 ms / 2,000 ms
コード長 438 bytes
コンパイル時間 2,156 ms
コンパイル使用メモリ 74,436 KB
実行使用メモリ 54,388 KB
最終ジャッジ日時 2024-05-03 19:47:03
合計ジャッジ時間 6,150 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
52,560 KB
testcase_01 AC 117 ms
53,976 KB
testcase_02 AC 111 ms
52,700 KB
testcase_03 AC 124 ms
54,016 KB
testcase_04 AC 114 ms
53,920 KB
testcase_05 AC 119 ms
54,284 KB
testcase_06 AC 107 ms
53,052 KB
testcase_07 AC 114 ms
53,948 KB
testcase_08 AC 104 ms
53,392 KB
testcase_09 AC 113 ms
54,148 KB
testcase_10 AC 103 ms
52,576 KB
testcase_11 AC 108 ms
53,376 KB
testcase_12 AC 122 ms
53,852 KB
testcase_13 AC 115 ms
53,796 KB
testcase_14 AC 103 ms
53,060 KB
testcase_15 AC 111 ms
54,104 KB
testcase_16 AC 134 ms
53,912 KB
testcase_17 AC 114 ms
54,064 KB
testcase_18 AC 135 ms
53,976 KB
testcase_19 AC 119 ms
53,508 KB
testcase_20 AC 135 ms
54,156 KB
testcase_21 AC 183 ms
54,140 KB
testcase_22 AC 182 ms
54,256 KB
testcase_23 AC 183 ms
54,228 KB
testcase_24 AC 180 ms
54,364 KB
testcase_25 AC 183 ms
54,388 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