結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
57,492 KB
testcase_01 AC 141 ms
57,760 KB
testcase_02 AC 141 ms
57,180 KB
testcase_03 AC 482 ms
61,956 KB
testcase_04 AC 538 ms
62,104 KB
testcase_05 AC 519 ms
62,028 KB
testcase_06 AC 565 ms
62,132 KB
testcase_07 AC 413 ms
61,704 KB
testcase_08 AC 450 ms
62,028 KB
testcase_09 AC 535 ms
62,036 KB
testcase_10 AC 417 ms
61,772 KB
testcase_11 AC 260 ms
60,836 KB
testcase_12 AC 447 ms
61,844 KB
testcase_13 AC 552 ms
62,032 KB
testcase_14 AC 344 ms
61,676 KB
testcase_15 AC 438 ms
61,848 KB
testcase_16 AC 509 ms
62,116 KB
testcase_17 AC 500 ms
62,028 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 142 ms
57,308 KB
testcase_21 AC 143 ms
57,560 KB
testcase_22 AC 141 ms
57,480 KB
testcase_23 AC 553 ms
61,996 KB
testcase_24 AC 374 ms
61,660 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 = 0; i < l; i++) {
			int res = X - i;
			if(res >= 0 && res <= 100000) {
				ans += a[i] * a[res];
			}
		}
		System.out.println(ans);
	}
}
0