結果

問題 No.723 2つの数の和
ユーザー taichi_hobbiestaichi_hobbies
提出日時 2019-06-02 14:48:18
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 618 bytes
コンパイル時間 3,342 ms
コンパイル使用メモリ 77,792 KB
実行使用メモリ 62,152 KB
最終ジャッジ日時 2023-10-17 23:02:53
合計ジャッジ時間 8,954 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
57,412 KB
testcase_01 AC 131 ms
57,112 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 136 ms
57,352 KB
testcase_21 AC 133 ms
57,624 KB
testcase_22 AC 134 ms
57,524 KB
testcase_23 AC 530 ms
62,008 KB
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Question723 {
	public static void main(String[] args) {

		//long start = System.currentTimeMillis();

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int X = sc.nextInt();
		int a[] = new int[N];
		int t[] = new int[N + 1];
		int result = 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 && 100000 >= X - a[i]) {
				result += t[X - a[i]];
			}

		}
		//		long end = System.currentTimeMillis();
		//	System.out.println((end - start) + "ms");
		System.out.println(result);
	}
}
0