有三个点RE,怎么改都不对
查看原帖
有三个点RE,怎么改都不对
957640
Michelle01楼主2023/7/10 20:00

啊啊啊啊!!!!


但是,我提交了之后还是有问题,有三个点RE


// c++从入门到入坟.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
#include<iostream>
#include <stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;

int c[100], m[100], e[100];


struct node{
	
	int ch;
	int math;
	int engilsh; 
	int w;
	int m;
	int he;	
	int empty;
} a[100], o[100];

bool cmp(node x, node y){
	if(x.empty == y.empty){
		return x.ch > y.ch;
		if(x.ch == y.ch){
			return x.w < y.m;
		}
	}
	return x.empty > y.empty;
}

int main(){
	
	
	int n;
	cin >> n;
	int max = 0;
	for(int i = 1; i <= n; i++){
		cin >> o[i].ch >> o[i].math >> o[i].engilsh;
		o[i].w = i;
		o[i].empty = o[i].ch + o[i].math + o[i].engilsh; 
	}
	
	sort(o + 1, o + 1 + n, cmp);
	
	for(int i = 1; i <= 5; i++){
		cout << o[i].w  << " " << o[i].empty << endl;
	}
	return 0;
}





// 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单
// 调试程序: F5 或调试 >“开始调试”菜单


2023/7/10 20:00
加载中...