cmp:我错哪了
  • 板块P1102 A-B 数对
  • 楼主luzhuohan
  • 当前回复12
  • 已保存回复12
  • 发布时间2024/7/20 17:56
  • 上次更新2024/7/20 19:34:59
查看原帖
cmp:我错哪了
1199910
luzhuohan楼主2024/7/20 17:56

DEV编译时说不支持命名返回值,具体如下: [Error] named return values are no longer supported

#include <bits/stdc++.h>

using namespace std;

long long c,n;

bool cmp(int x,int y) return x < y;

int main(){
    int a[n];
    
    for(int i = 0;i < n;i++) cin >> a[n];
    
    sort(a+0,a+n,cmp);
    
    int sum = 0;
    for(int i = n;i > n/2;i--){
        for(int j = 0;j < n/2;j++){  
            if(a[j] - a[i] == c) sum++;
        }
    }
	cout << sum;
	return 0;
}
2024/7/20 17:56
加载中...