結果

問題 No.723 2つの数の和
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2019-02-10 15:28:03
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 372 bytes
コンパイル時間 1,188 ms
コンパイル使用メモリ 144,056 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-20 15:07:55
合計ジャッジ時間 2,444 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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;
    int 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