結果

問題 No.723 2つの数の和
コンテスト
ユーザー yui556
提出日時 2018-08-24 16:01:00
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
TLE  
実行時間 -
コード長 572 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,276 ms
コンパイル使用メモリ 83,592 KB
実行使用メモリ 128,640 KB
最終ジャッジ日時 2026-03-06 11:00:12
合計ジャッジ時間 39,600 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 2 TLE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.util.Scanner;

public class No_723 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		final int X = sc.nextInt();
		int count = 0;
		int mid = X / 2;
		int[] aa = new int[N];
		for (int i = 0; i < N; i++) {
			aa[i] = sc.nextInt();
		}

		for (int i = 0; i < N; i++) {
			for (int y = i + 1; y < N; y++) {
				if (aa[i] + aa[y] == X) {
					count++;
				}
			}


		}


		count *= 2;
		for (int i = 0; i < N; i++)
			if (mid == aa[i] && X % 2 == 0)
				count++;
		System.out.println(count);
	}
}
0