結果
| 問題 | 
                            No.723 2つの数の和
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2018-09-02 22:21:17 | 
| 言語 | C++17(clang)  (17.0.6 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 387 bytes | 
| コンパイル時間 | 495 ms | 
| コンパイル使用メモリ | 119,552 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-30 12:39:03 | 
| 合計ジャッジ時間 | 1,646 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 15 WA * 7 | 
ソースコード
#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;
	return 0;
}