結果

問題 No.723 2つの数の和
ユーザー masamasa
提出日時 2019-01-16 16:19:18
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 442 bytes
コンパイル時間 1,846 ms
コンパイル使用メモリ 71,344 KB
実行使用メモリ 66,280 KB
最終ジャッジ日時 2023-09-10 17:55:55
合計ジャッジ時間 12,654 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
60,440 KB
testcase_01 AC 121 ms
60,004 KB
testcase_02 AC 121 ms
59,996 KB
testcase_03 AC 468 ms
64,620 KB
testcase_04 AC 507 ms
62,348 KB
testcase_05 AC 473 ms
64,604 KB
testcase_06 AC 519 ms
64,424 KB
testcase_07 AC 377 ms
65,052 KB
testcase_08 AC 411 ms
64,716 KB
testcase_09 AC 491 ms
64,644 KB
testcase_10 AC 380 ms
64,548 KB
testcase_11 AC 233 ms
63,500 KB
testcase_12 AC 398 ms
66,280 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 122 ms
60,580 KB
testcase_21 AC 122 ms
59,848 KB
testcase_22 AC 128 ms
60,116 KB
testcase_23 AC 494 ms
64,592 KB
testcase_24 AC 330 ms
64,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n   = sc.nextInt();
		int x   = sc.nextInt();
		int a[] = new int[n];
		int t[] = new int[1000000];
		int ans = 0;
		
		for (int i = 0; i < n; i++) {
		    a[i] = sc.nextInt();
		    t[a[i]]++;
		}
		
		for (int i = 0; i < n; i++) {
		    if (x - a[i] >= 0) ans += t[x - a[i]];
		}
		
		System.out.println(ans);
	}
}
0