結果

問題 No.360 増加門松列
ユーザー 37zigen37zigen
提出日時 2016-04-17 23:50:43
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 930 bytes
コンパイル時間 2,405 ms
コンパイル使用メモリ 78,340 KB
実行使用メモリ 54,596 KB
最終ジャッジ日時 2024-04-15 02:31:59
合計ジャッジ時間 5,335 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
53,984 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 115 ms
54,212 KB
testcase_07 WA -
testcase_08 AC 107 ms
52,972 KB
testcase_09 AC 108 ms
53,284 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 121 ms
54,544 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 121 ms
54,324 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;
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>0)countc++;
				count=0;
			}
		}
		if(count>0)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");
		}
	}
}
0