80分求调
查看原帖
80分求调
1635990
Dzbxk楼主2025/1/20 22:45

80分求调

#include<bits/stdc++.h>
using namespace std;
int main()
{
	char a[1001][21],b,name[20];
	int n,j=0,d[1001],num1,num2,num3,max,c=0;
	scanf("%d", &n);
	getchar();
	for (int i = 0; i < n; i++) {
		while ((b = getchar()) != EOF && j < 21) {
			if (b == '\n')
				break;
			a[i][j++] = b;
		}
		a[i][j] = '\0';
		sscanf(a[i], "%s %d %d %d",name, & num1, &num2, &num3);
		d[i] = num1 + num2 + num3;
		j = 0;
	}
	max = d[0];
	for (int i = 0; i < n; i++) {
		if (d[i] > max) {
			max = d[i];
			c = i;
		}
	}
	printf("%s",a[c]);
}
2025/1/20 22:45
加载中...