#3WA求救c⌒っ゚Д゚)っ
查看原帖
#3WA求救c⌒っ゚Д゚)っ
1161140
wen_wen_wen楼主2024/11/1 21:18
#include<bits/stdc++.h>

using namespace std;

int main(){
    int n, c;
    cin >> n;
    cin >> c;
    unordered_map<int, int> hash;
    unordered_map<int, int> hashb;
    for (int i = 0; i < n;i++){
        int x;
        cin >> x;
        hash[x]++;
        int y = x - c;
        hashb[x - c]++;
    }
    int sum = 0;
    for(const auto&pair:hashb){
        sum += hash[pair.first] * pair.second;
    }
    
    cout << sum;
    return 0;
}

我感觉可以处理1 2啊,为什么数据量大了就会wa

2024/11/1 21:18
加载中...