結果

問題 No.436 ccw
ユーザー darknightdarknight
提出日時 2016-10-28 22:37:37
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 626 bytes
コンパイル時間 2,103 ms
コンパイル使用メモリ 71,972 KB
実行使用メモリ 56,484 KB
最終ジャッジ日時 2023-08-15 21:05:49
合計ジャッジ時間 7,087 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,988 KB
testcase_01 AC 118 ms
55,784 KB
testcase_02 AC 118 ms
55,436 KB
testcase_03 AC 117 ms
55,600 KB
testcase_04 AC 118 ms
55,856 KB
testcase_05 WA -
testcase_06 AC 119 ms
55,756 KB
testcase_07 AC 120 ms
56,268 KB
testcase_08 AC 119 ms
55,972 KB
testcase_09 AC 118 ms
55,608 KB
testcase_10 AC 117 ms
55,600 KB
testcase_11 AC 119 ms
55,796 KB
testcase_12 AC 122 ms
55,564 KB
testcase_13 AC 121 ms
55,752 KB
testcase_14 AC 119 ms
55,440 KB
testcase_15 AC 119 ms
55,336 KB
testcase_16 AC 134 ms
55,692 KB
testcase_17 AC 127 ms
54,452 KB
testcase_18 AC 132 ms
56,128 KB
testcase_19 AC 135 ms
56,064 KB
testcase_20 AC 134 ms
55,436 KB
testcase_21 AC 212 ms
56,332 KB
testcase_22 AC 197 ms
56,072 KB
testcase_23 AC 206 ms
56,300 KB
testcase_24 AC 201 ms
56,484 KB
testcase_25 AC 203 ms
56,108 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<2 || q < 1) System.out.print("0");
        else if(p>=q)    System.out.print(q);
        else if(q>p)     System.out.print(p-1);
 

              

        System.out.println();
	}
}
0