結果

問題 No.723 2つの数の和
ユーザー nuto321nuto321
提出日時 2018-08-25 14:08:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 472 bytes
コンパイル時間 492 ms
コンパイル使用メモリ 65,904 KB
実行使用メモリ 5,076 KB
最終ジャッジ日時 2023-09-08 06:37:04
合計ジャッジ時間 2,112 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 21 ms
4,964 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 26 ms
4,992 KB
testcase_07 AC 13 ms
4,440 KB
testcase_08 AC 14 ms
4,532 KB
testcase_09 AC 27 ms
4,864 KB
testcase_10 WA -
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 16 ms
4,592 KB
testcase_13 AC 29 ms
4,976 KB
testcase_14 AC 8 ms
4,520 KB
testcase_15 AC 13 ms
4,448 KB
testcase_16 AC 19 ms
4,600 KB
testcase_17 AC 24 ms
4,756 KB
testcase_18 AC 15 ms
4,380 KB
testcase_19 WA -
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

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[100001];
	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 < 100001; k++) {
		if (X - k >= 0 && X-k<100001) {
			Ans = Ans + (b[k] * b[X - k]);
		}
		
	}

	cout << Ans;


	return 0;
}
0