結果

問題 No.436 ccw
ユーザー poopi_pokepoopi_poke
提出日時 2016-11-25 15:55:21
言語 Java19
(openjdk 21)
結果
AC  
実行時間 207 ms / 2,000 ms
コード長 455 bytes
コンパイル時間 3,177 ms
コンパイル使用メモリ 72,320 KB
実行使用メモリ 57,276 KB
最終ジャッジ日時 2023-08-18 07:34:03
合計ジャッジ時間 7,722 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
56,072 KB
testcase_01 AC 107 ms
56,052 KB
testcase_02 AC 107 ms
56,108 KB
testcase_03 AC 103 ms
55,832 KB
testcase_04 AC 106 ms
55,836 KB
testcase_05 AC 110 ms
56,060 KB
testcase_06 AC 107 ms
55,696 KB
testcase_07 AC 107 ms
55,884 KB
testcase_08 AC 106 ms
55,472 KB
testcase_09 AC 107 ms
55,820 KB
testcase_10 AC 111 ms
55,792 KB
testcase_11 AC 110 ms
55,748 KB
testcase_12 AC 112 ms
56,140 KB
testcase_13 AC 110 ms
56,272 KB
testcase_14 AC 109 ms
56,332 KB
testcase_15 AC 109 ms
56,208 KB
testcase_16 AC 133 ms
56,020 KB
testcase_17 AC 141 ms
56,220 KB
testcase_18 AC 136 ms
56,560 KB
testcase_19 AC 141 ms
55,812 KB
testcase_20 AC 144 ms
56,688 KB
testcase_21 AC 198 ms
56,452 KB
testcase_22 AC 197 ms
56,640 KB
testcase_23 AC 207 ms
56,644 KB
testcase_24 AC 199 ms
57,072 KB
testcase_25 AC 200 ms
57,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.util.regex.*;
public class A{
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		int c=a(s,"c");
		int w=a(s,"w");
		if(c>=w+1){
			System.out.print(w);
		}else{
			System.out.print(c-1);
		}
	}
		
	public static int a(String s,String c){
		int count=0;
		Pattern p = Pattern.compile(c);
 		Matcher m = p.matcher(s);
		while(m.find()){
			count++;
		}
		return count;
	}
}
0