結果

問題 No.723 2つの数の和
ユーザー YamaKasaYamaKasa
提出日時 2018-08-04 12:21:53
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 469 bytes
コンパイル時間 2,241 ms
コンパイル使用メモリ 74,184 KB
実行使用メモリ 62,228 KB
最終ジャッジ日時 2023-10-19 21:48:11
合計ジャッジ時間 12,897 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
57,576 KB
testcase_01 AC 133 ms
57,524 KB
testcase_02 AC 132 ms
57,536 KB
testcase_03 AC 489 ms
62,028 KB
testcase_04 AC 540 ms
62,032 KB
testcase_05 AC 493 ms
61,944 KB
testcase_06 AC 537 ms
62,160 KB
testcase_07 AC 389 ms
61,640 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 411 ms
61,908 KB
testcase_11 AC 252 ms
60,584 KB
testcase_12 AC 423 ms
61,908 KB
testcase_13 AC 525 ms
62,024 KB
testcase_14 AC 342 ms
61,576 KB
testcase_15 AC 412 ms
61,952 KB
testcase_16 AC 463 ms
61,980 KB
testcase_17 AC 521 ms
62,028 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 133 ms
57,500 KB
testcase_22 AC 132 ms
57,704 KB
testcase_23 AC 535 ms
62,020 KB
testcase_24 AC 354 ms
61,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int X = scan.nextInt();
		int l = 100001;
		int []a = new int[l];

		for(int i = 0; i < N; i++) {
			a[scan.nextInt()] ++;
		}
		scan.close();
		long ans = 0;
		for(int i = 1; i < l; i++) {
			int res = X - i;
			if(res >= 1 && res <= 100000) {
				ans += a[i] * a[res];
			}
		}
		System.out.println(ans);
	}
}
0