結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
権限があれば一括ダウンロードができます

ソースコード

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<7;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){
			if(countc==3){
				if(d[0]!=d[1]||d[5]!=d[6]){
					System.out.println("YES");
					return;
				}	
			}else{
				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