結果

問題 No.349 干支の置き物
ユーザー 37zigen37zigen
提出日時 2016-03-11 23:13:29
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,489 bytes
コンパイル時間 3,795 ms
コンパイル使用メモリ 79,208 KB
実行使用メモリ 57,756 KB
最終ジャッジ日時 2023-10-25 05:54:22
合計ジャッジ時間 9,953 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 149 ms
57,188 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package 練習;

import java.util.Date;
import java.util.Scanner;
public class main{
	public static void main(String[] args){
		long exec_time=new Date().getTime();
		Scanner sc=new Scanner(System.in);
		int ne=0;
		int ushi=0;
		int tora=0;
		int u=0;
		int tatsu=0;
		int mi=0;
		int uma=0;
		int hitsuji=0;
		int saru=0;
		int tori=0;
		int inu=0;
		int i=0;

		int n=sc.nextInt();
		int max=0;
		int sum=0;
		for(int j=0;j<n;j++){
			String str=sc.next();
			if(str.equals("ne"))ne++;
			if(str.equals("ushi"))ushi++;
			if(str.equals("tora"))tora++;
			if(str.equals("u"))u++;
			if(str.equals("tatsu"))tatsu++;
			if(str.equals("mi"))mi++;
			if(str.equals("uma"))uma++;
			if(str.equals("hitsuji"))hitsuji++;
			if(str.equals("saru"))saru++;
			if(str.equals("tori"))tori++;
			if(str.equals("inu"))inu++;
			if(str.equals("i"))i++;
		}


		sum=ne+ushi+tora+u+tatsu+mi+uma+hitsuji+saru+tori+inu+i;
		max=Math.max(
				Math.max(
						Math.max(
								Math.max(
										Math.max(
												Math.max(
														Math.max(
																Math.max(
																		Math.max(
																				Math.max(
																						Math.max(ne,ushi),tora),u),tatsu),mi),uma),hitsuji),saru),tori),inu),i);
		int sum_sub=sum-max;
		if(max==1)
		if(max>=sum_sub-2){
			System.out.println("NO");
		}else{
			System.out.println("YES");
		}
		//System.out.println("sum_sub="+sum_sub);
		//System.out.println("max="+max);
		System.err.println(new Date().getTime()-exec_time+"ms");

	}
}
0