結果

問題 No.360 増加門松列
ユーザー 37zigen37zigen
提出日時 2016-04-18 00:05:18
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 995 bytes
コンパイル時間 1,999 ms
コンパイル使用メモリ 77,896 KB
実行使用メモリ 54,384 KB
最終ジャッジ日時 2024-04-15 02:35:23
合計ジャッジ時間 5,561 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 119 ms
54,328 KB
testcase_03 AC 121 ms
54,244 KB
testcase_04 WA -
testcase_05 AC 120 ms
54,152 KB
testcase_06 WA -
testcase_07 AC 119 ms
54,292 KB
testcase_08 WA -
testcase_09 AC 121 ms
53,864 KB
testcase_10 AC 108 ms
53,152 KB
testcase_11 AC 122 ms
54,116 KB
testcase_12 WA -
testcase_13 AC 123 ms
54,160 KB
testcase_14 AC 120 ms
54,368 KB
testcase_15 AC 109 ms
52,860 KB
testcase_16 AC 108 ms
52,992 KB
testcase_17 AC 123 ms
54,344 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 106 ms
53,132 KB
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;
public class Main{
	public static void main(String[] args)throws Exception{
		new Main().solve();
	}
	void solve(){
		Scanner sc=new Scanner(System.in);
		int[] d=new int[7];
		for(int i=0;i<7;i++){
			d[i]=sc.nextInt();
		}
		Arrays.sort(d);
		int count=1;
		int countM=1;
		int countc=0;
		for(int i=0;i<6;i++){
			if(d[i]==d[i+1]){
				count++;
				countM=Math.max(countM, count);
			}else{
				if(count>1)countc++;
				count=1;
			}
		}
		if(count>1)countc++;
//		System.out.println(countc);
		if(countc>=3){
			System.out.println("NO");
			return;
		}
//		if(countc==2){
//			if((d[0]==d[1]&&d[2]==d[3])||(d[5]==d[6]&&d[3]==d[4])){
//				System.out.println("NO");
//				return;
//			}	
//		}
		if(countM>=3){
			if(countM==3){
				if(d[2]==d[3]&&d[3]==d[4]){
					if((d[1]!=d[0])||(d[5]!=d[6])){
						System.out.println("YES");
						return;
					}
				}
			}
			System.out.println("NO");
			return;
		}
		System.out.println("YES");
	}
}
0