結果

問題 No.723 2つの数の和
ユーザー GB
提出日時 2018-09-02 22:23:10
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 403 bytes
コンパイル時間 514 ms
コンパイル使用メモリ 118,272 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-30 12:39:01
合計ジャッジ時間 2,295 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>

using namespace std;

int main() {

	int n, x;
	int cnt[101010];
	int* array;

	cin >> n >> x;
	array = new int[n];
	for (int i = 0;i < n;i++) {
		cin >> array[i];
	}
	for (int i = 0;i < n;i++) {
		cnt[array[i]]++;
	}

	int ans = 0;
	for (int i = 0;i < n;i++) {
		int d = x - array[i];
		if (d >= 0 && d <= 100000)ans += cnt[d];
	}
	cout << ans << endl;

	delete array;

	return 0;
}
0