【计蒜客】泥塑课

题目:https://nanti.jisuanke.com/t/6
#include
#include
using namespace std;
int main(){
    int n,l,w,h,min=251,max=0;
    char name[10][10];
    int clay[10];
    int num = 0; // class number
    char name1[10][10],name2[10][10];
    scanf("%d",&n);
    while(n != -1){
        for(int i = 0;i < n; i++){
            scanf("%d%d%d",&l,&w,&h);
            clay[n] = l*w*h;
            scanf("%s",name[n]);
            if(clay[n]>max){
                max = clay[n];
                strcpy(name1[num], name[n]);
            }
            if(clay[n]< min){
                min = clay[n];
                strcpy(name2[num] , name[n]);
            }
        }

        num++;
        scanf("%d",&n);
        max = 0;
        min = 251;
    }
    for(int i = 0; i < num; i++){

        printf("%s took clay from %s.\n",name1[i],name2[i]);

    }
    return 0;
}

你可能感兴趣的:(计蒜客)