結果

問題 No.723 2つの数の和
ユーザー saitam05014081
提出日時 2018-08-18 20:42:57
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 682 bytes
コンパイル時間 643 ms
コンパイル使用メモリ 85,132 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-06 20:49:41
合計ジャッジ時間 3,632 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 6 WA * 7 RE * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <unordered_map>
#include <utility>
#include <map>
#include <set>
using namespace std;

int main(){
    long long int n, x;
    cin >> n >> x;
    long long int data[100001];
    long long int nums[n];
    long long int i;
    long long int ans = 0;
    
    for(i = 0; i < 100001; i++){
        data[i] = 0;
    }
    
    int a;
    for(i = 0; i < n; i++){
        cin >> a;
        nums[i] = a;
        data[a] += 1;
    }
    
    for(i = 0; i < n; i++){
        ans += data[x-nums[i]];
    }
    
    cout << ans << endl;
}
0