結果

問題 No.723 2つの数の和
ユーザー Mcpu3Mcpu3
提出日時 2018-08-19 17:18:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 639 ms / 2,000 ms
コード長 389 bytes
コンパイル時間 2,657 ms
コンパイル使用メモリ 74,644 KB
実行使用メモリ 49,036 KB
最終ジャッジ日時 2024-04-28 20:10:39
合計ジャッジ時間 14,487 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
41,840 KB
testcase_01 AC 129 ms
42,372 KB
testcase_02 AC 120 ms
40,684 KB
testcase_03 AC 544 ms
48,784 KB
testcase_04 AC 637 ms
48,984 KB
testcase_05 AC 561 ms
48,720 KB
testcase_06 AC 639 ms
48,860 KB
testcase_07 AC 458 ms
48,880 KB
testcase_08 AC 502 ms
48,560 KB
testcase_09 AC 624 ms
49,036 KB
testcase_10 AC 462 ms
48,316 KB
testcase_11 AC 255 ms
47,540 KB
testcase_12 AC 519 ms
48,576 KB
testcase_13 AC 576 ms
48,712 KB
testcase_14 AC 351 ms
48,476 KB
testcase_15 AC 468 ms
48,916 KB
testcase_16 AC 503 ms
48,952 KB
testcase_17 AC 596 ms
48,928 KB
testcase_18 AC 536 ms
48,436 KB
testcase_19 AC 558 ms
48,424 KB
testcase_20 AC 129 ms
41,812 KB
testcase_21 AC 131 ms
42,024 KB
testcase_22 AC 134 ms
42,088 KB
testcase_23 AC 513 ms
48,492 KB
testcase_24 AC 389 ms
48,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt(),x=sc.nextInt(),a[]=new int[100000],t[]=new int[100001],i;
		long s=0;
		for(i=0;i<n;i++) {
			a[i]=sc.nextInt();
			t[a[i]]++;
		}
		sc.close();
		for(i=0;i<n;i++) if(x-a[i]>=0&&100000>=x-a[i]) s+=t[x-a[i]];
		System.out.print(s);
	}
}
0