995 995 !!!

qym 山顶洞人 2024-02-06 14:52:29 32
#include<iostream>
#include <algorithm>
using namespace std;
struct a{
	int b;
	int c;
}d[7];
bool e(a f,a g){
	return f.b>g.b;
}
int main(){
    int h,j;
	for(int i=0;i<7;i++){
		cin>>h>>j;
		d[i].b=h+j;
		d[i].c=i;
	}
	sort(d,d+7,e);
	cout<<d[0].c;
    return 0;
}
{{ vote && vote.total.up }}

共 2 条回复

perryrdoen
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,ret=0,x=0;
	for(int i=1;i<=7;i++)
	{
		scanf("%d%d",&a,&b);
		if(ret<a+b&&a+b>8)
		{
			ret=a+b;
			x=i;
		}
	}
	printf("%d",x);
	return 0;
}
root 站长

cout << d[0].c 这个错了,你是星期 0 开始的~