結果

問題 No.723 2つの数の和
ユーザー 🍮かんプリン
提出日時 2019-02-10 15:29:11
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 370 bytes
コンパイル時間 1,314 ms
コンパイル使用メモリ 159,720 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-06 10:17:22
合計ジャッジ時間 2,519 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define ll long long int

int a[100001];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x;
    ll n,c=0,p,m=0;
    cin >> n >> x;
    for (int i=0;i<n;i++) { cin>>p; a[p]++; m=m<p?p:m;}
    for (int i=0;i<=m;i++) {
        if (x-i<=m&&x>=m) c+=a[x-i]*a[i];
    }
    cout << c << endl;
    return 0;
}
0