#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define N 5
typedef struct Consume
{
int id;
unsigned pid;
char p[100];
float cost;
}Consume;
void maxCost(struct Consume record[N])
{
for (int i=0;i<N;i++)
{
for (int j=0;j<N-1;j++)
{
if(record[j].pid>record[j+1].pid)
{
Consume temp=record[j];
record[j]=record[j+1];
record[j+1]=temp;
}
}
}
int mcost=0;
char *pname=NULL;
int curcost=0;
int prepid=record[0].pid;
for(int i=0;i<N;i++)
{
if(record[i].pid==prepid)
{
curcost+=record[i].cost;
}
else
{
if(curcost>mcost)
{
mcost=curcost;
pname=record[i-1].p;
}
curcost=record[i].cost;
prepid=record[i].pid;
}
}
if(curcost>mcost)
{
printf("%d %s",curcost,record[N-1].p);
}
else
{
printf("%d %s",mcost,*pname);
}
}