gebilaowang6 @ 2022-10-04 16:26:40
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<algorithm>
using namespace std;
void get(char* p)
{
int i = 0;
char ch;
while ((ch = getchar()) != ' ')
{
*(p + i) = ch;
i++;
}
*(p + i) = '\0';
}
int main()
{
char input[40];
char best[40];
int n;
scanf("%d", &n);
int a, b, c;
int d=0, e=0, f=0;
int max = 0;
int sum;
getchar();
for (int i = 0; i < n; i++)
{
get(input);
scanf("%d %d %d", &a, &b, &c);
sum = a + b + c;
if (sum > max)
{
swap(sum, max);
strcpy(best, input);
d = a, e = b, f = c;
}
}
int i = 0;
while (best[i])
{
if (best[i] == '\n')
{
i++;
continue;
}
else
{
putchar(best[i]);
i++;
}
}
printf(" %d %d %d", d, e, f);
}
by so_find_skind @ 2022-10-04 16:47:10
结构体px
by gebilaowang6 @ 2022-10-04 16:48:49
@zhezhikongdanruxue 结构体有想过,但是感觉有点麻烦,不知道我这个为什么不能运行,我找了题解的和我对过几个数据,结果都是一样的