結果

問題 No.723 2つの数の和
ユーザー saitam05014081saitam05014081
提出日時 2018-08-18 20:45:35
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 725 bytes
コンパイル時間 653 ms
コンパイル使用メモリ 84,648 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 12:49:16
合計ジャッジ時間 3,343 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,248 KB
testcase_03 AC 21 ms
5,248 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 28 ms
5,376 KB
testcase_07 AC 12 ms
5,376 KB
testcase_08 AC 14 ms
5,376 KB
testcase_09 AC 28 ms
5,376 KB
testcase_10 RE -
testcase_11 AC 4 ms
5,376 KB
testcase_12 AC 16 ms
5,376 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 16 ms
5,376 KB
testcase_19 AC 32 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 27 ms
5,376 KB
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

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++){
        if(x-nums[i] >= 0){
            ans += data[x-nums[i]];
        }
    }
    
    cout << ans << endl;
}
0