結果

問題 No.1395 Less Sweet Alchemy
ユーザー xRS43BofaUEZ5gcxRS43BofaUEZ5gc
提出日時 2021-03-05 09:19:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 152 ms / 2,000 ms
コード長 804 bytes
コンパイル時間 3,963 ms
コンパイル使用メモリ 74,960 KB
実行使用メモリ 41,884 KB
最終ジャッジ日時 2024-04-15 22:27:53
合計ジャッジ時間 6,285 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
41,580 KB
testcase_01 AC 133 ms
41,400 KB
testcase_02 AC 133 ms
41,640 KB
testcase_03 AC 133 ms
41,140 KB
testcase_04 AC 132 ms
41,668 KB
testcase_05 AC 139 ms
41,616 KB
testcase_06 AC 152 ms
41,588 KB
testcase_07 AC 143 ms
41,760 KB
testcase_08 AC 144 ms
41,884 KB
testcase_09 AC 134 ms
41,724 KB
testcase_10 AC 135 ms
41,484 KB
testcase_11 AC 144 ms
41,760 KB
testcase_12 AC 143 ms
41,812 KB
testcase_13 AC 144 ms
41,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class HelloWorld {

	    public static void main(String[] args) throws Exception {

	    	Scanner sc = new Scanner(System.in);
	    	int n = sc.nextInt();
	    	int x = sc.nextInt();
	    	int[] ci = new int[n];

	    	boolean flag_equal = false;
	    	boolean flag_smaller = false;
	    	boolean flag_bigger = false;
	    	for (int i=0; i < n; i ++) {
	    		ci[i] = sc.nextInt();
	    		if (ci[i] == x) {flag_equal = true;}
	    		if (ci[i] > x) {flag_bigger = true;}
	    		if (ci[i] < x) {flag_smaller = true;}
	    	}
	    	sc.close();

	    	if (flag_equal == true) {
	    		System.out.println("Yes");
	    	}else if (flag_bigger ==true && flag_smaller == true) {
	    		System.out.println("Yes");
	    	}else {
	    		System.out.println("No");
	    	}

	    }
}

0