結果

問題 No.436 ccw
ユーザー darknightdarknight
提出日時 2016-10-28 22:40:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 221 ms / 2,000 ms
コード長 576 bytes
コンパイル時間 2,143 ms
コンパイル使用メモリ 72,488 KB
実行使用メモリ 56,932 KB
最終ジャッジ日時 2023-08-15 21:08:13
合計ジャッジ時間 7,248 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,060 KB
testcase_01 AC 120 ms
56,024 KB
testcase_02 AC 121 ms
55,740 KB
testcase_03 AC 121 ms
56,144 KB
testcase_04 AC 118 ms
55,440 KB
testcase_05 AC 121 ms
55,444 KB
testcase_06 AC 122 ms
55,820 KB
testcase_07 AC 121 ms
55,796 KB
testcase_08 AC 122 ms
55,848 KB
testcase_09 AC 121 ms
55,740 KB
testcase_10 AC 120 ms
55,432 KB
testcase_11 AC 122 ms
56,032 KB
testcase_12 AC 121 ms
55,796 KB
testcase_13 AC 120 ms
55,872 KB
testcase_14 AC 119 ms
55,948 KB
testcase_15 AC 125 ms
55,712 KB
testcase_16 AC 138 ms
55,932 KB
testcase_17 AC 130 ms
55,880 KB
testcase_18 AC 137 ms
55,872 KB
testcase_19 AC 136 ms
55,988 KB
testcase_20 AC 137 ms
55,888 KB
testcase_21 AC 215 ms
56,184 KB
testcase_22 AC 215 ms
56,624 KB
testcase_23 AC 221 ms
56,276 KB
testcase_24 AC 220 ms
56,764 KB
testcase_25 AC 211 ms
56,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
 
public class Main {
	public static void main(String[] args) {
 
		Scanner sc  = new Scanner(System.in);

		int o = 0 ,p = 0,q = 0;
		long a = 0, b = 0, c = 0;
		char ch;
		String str;
		
        String s1 = sc.next();
        char[] c1 = s1.toCharArray();
        
        for(int i = 0; i < s1.length(); i++ ){
             if( c1[i]=='c' ) p++;
            if( c1[i]=='w' ) q++;
        
        }
        
       
        if(p>q)    System.out.print(q);
        if(q>=p)     System.out.print(p-1);
 

              

        System.out.println();
	}
}
0