結果

問題 No.723 2つの数の和
ユーザー yoneoka1985
提出日時 2018-10-17 20:46:58
言語 Java
(openjdk 23)
結果
TLE  
実行時間 -
コード長 643 bytes
コンパイル時間 2,108 ms
コンパイル使用メモリ 74,972 KB
実行使用メモリ 63,600 KB
最終ジャッジ日時 2024-10-12 18:54:30
合計ジャッジ時間 5,952 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other TLE * 1 -- * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder.wa;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int count = 0;

		int[] num = new int[n];

		Set<Integer> num_ = new HashSet<>();

		for (int i = 0; i < n; i++) {
			num[i] = sc.nextInt();
			// num_.add(sc.nextInt());
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (num[i] + num[j] == x) {
					count++;
				}
			}
		}
		for (Integer i : num_) {
			System.out.println(i);
		}

		System.out.println(count);
	}

}
0