結果

問題 No.723 2つの数の和
ユーザー nuto321nuto321
提出日時 2018-08-25 14:10:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 463 bytes
コンパイル時間 487 ms
コンパイル使用メモリ 66,864 KB
実行使用メモリ 5,940 KB
最終ジャッジ日時 2023-09-08 06:47:08
合計ジャッジ時間 2,898 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,952 KB
testcase_01 AC 2 ms
5,160 KB
testcase_02 AC 3 ms
4,976 KB
testcase_03 AC 22 ms
5,452 KB
testcase_04 AC 27 ms
5,868 KB
testcase_05 AC 25 ms
5,532 KB
testcase_06 AC 26 ms
5,908 KB
testcase_07 AC 14 ms
5,212 KB
testcase_08 AC 15 ms
5,252 KB
testcase_09 AC 28 ms
5,644 KB
testcase_10 AC 13 ms
5,184 KB
testcase_11 AC 5 ms
4,988 KB
testcase_12 AC 17 ms
5,276 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 17 ms
5,636 KB
testcase_19 AC 33 ms
5,688 KB
testcase_20 AC 3 ms
5,004 KB
testcase_21 AC 3 ms
4,920 KB
testcase_22 AC 3 ms
4,884 KB
testcase_23 AC 30 ms
5,940 KB
testcase_24 AC 10 ms
5,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <algorithm>

using namespace std;
int main()
{
	long long N, X;
	long long a[100001];
	long long b[200001] = {};
	long long Ans = 0;

	cin >> N >> X;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}

	for (int j = 0; j < N; j++) {
		b[a[j]]++;
	}

	for (int k = 0; k < 200001; k++) {
		if (X - k >= 0) {
			Ans = Ans + (b[k] * b[X - k]);
		}
		
	}

	cout << Ans;


	return 0;
}
0