結果

問題 No.436 ccw
ユーザー willowoooowillowoooo
提出日時 2016-11-05 00:18:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 194 ms / 2,000 ms
コード長 507 bytes
コンパイル時間 3,220 ms
コンパイル使用メモリ 73,288 KB
実行使用メモリ 57,828 KB
最終ジャッジ日時 2023-08-16 13:47:33
合計ジャッジ時間 8,187 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,432 KB
testcase_01 AC 119 ms
55,596 KB
testcase_02 AC 119 ms
55,860 KB
testcase_03 AC 120 ms
55,684 KB
testcase_04 AC 119 ms
55,952 KB
testcase_05 AC 121 ms
55,940 KB
testcase_06 AC 119 ms
55,680 KB
testcase_07 AC 119 ms
55,836 KB
testcase_08 AC 119 ms
55,712 KB
testcase_09 AC 119 ms
55,876 KB
testcase_10 AC 118 ms
55,788 KB
testcase_11 AC 119 ms
55,736 KB
testcase_12 AC 120 ms
55,916 KB
testcase_13 AC 120 ms
55,832 KB
testcase_14 AC 121 ms
55,792 KB
testcase_15 AC 119 ms
57,828 KB
testcase_16 AC 133 ms
55,676 KB
testcase_17 AC 126 ms
55,700 KB
testcase_18 AC 131 ms
55,684 KB
testcase_19 AC 134 ms
56,116 KB
testcase_20 AC 134 ms
53,968 KB
testcase_21 AC 194 ms
54,620 KB
testcase_22 AC 186 ms
56,272 KB
testcase_23 AC 185 ms
56,196 KB
testcase_24 AC 192 ms
56,280 KB
testcase_25 AC 189 ms
56,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package test;

import java.util.Arrays;
import java.util.Scanner;

public class No436 {
	void run() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int c = 0,w = 0;
		for(char x:s.toCharArray()){
			if(x == 'c'){
				c++;
			}
			else{
				w++;
			}
		}
		if(c - 1 >= w)
			System.out.println(w);
		else {
			System.out.println(c-1);
		}

	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new No436().run();
	}
}
0