結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
57,476 KB
testcase_01 AC 143 ms
57,472 KB
testcase_02 AC 142 ms
57,488 KB
testcase_03 AC 499 ms
61,888 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 574 ms
62,032 KB
testcase_07 AC 420 ms
61,736 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 RE -
testcase_11 AC 267 ms
61,100 KB
testcase_12 AC 447 ms
61,968 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 WA -
testcase_19 RE -
testcase_20 WA -
testcase_21 AC 144 ms
57,652 KB
testcase_22 AC 143 ms
57,412 KB
testcase_23 AC 559 ms
62,076 KB
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

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) {
				ans += a[i] * a[res];
			}
		}
		System.out.println(ans);
	}
}
0