Question 6th: Clay sculpture Course
Question 6th: Clay sculpture Course
Xiaomi is a kindergarten teacher. In every semester's Clay sculpture class, she will send up to 250 cm³ of the same amount of plasticine to each student to teach everyone how to make clay sculpture. During the course, she found that every class had a child who would grab the plasticine of another child. So she decided before the formal start of the clay sculpture, let everyone put the plasticine in their hands into a cube, and measure the length, width, and height of the Plasticine. In this way, she can know who snatched the Plasticine.
Miss Mi may bring one or more classes in different semesters, so there may be one or more groups of input data. The first act of each group of input data is an integer n, indicating the number of children in this class. The next n rows contain three integers and a string separated by spaces, the character string represents the name of the child. The first three integers are the length, width, and height data of the rubber block in the academic hand. According to kindergarten regulations, each class has a maximum of 9 children and at least two children. The name of each child in the student status system cannot exceed 8 characters. When the number of children in a class is-1, there are no more classes.
The number of output rows is the same as the number of classes in the form of "X took clay from Y.". For details, see the sample output.
Sample Input
310 10 2 Jill5 3 10 Will5 5 10 Bill42 4 10 Cam4 3 7 Sam8 11 1 Graham6 2 7 Pam-1
Sample output
Bill took clay from Will.Graham took clay from Cam.
Answer:
#include
#include
struct per{int size;char name[8];}per[9]; int main(){int pernum,i,j,x,y,z,a;char name1[8],name2[8];while(~scanf("%d",&pernum),pernum != -1){for(i = 0;i < pernum;i++){scanf("%d %d %d",&x,&y,&z);per[i].size = x*y*z;scanf("%s",per[i].name);}for(i = 0,a = 0;i < pernum;i++){if(a < per[i].size){strcpy(name1,per[i].name);a = per[i].size;}}strcpy(name2,per[0].name);for(i = 1,a = per[0].size;i < pernum;i++){if(a > per[i].size){strcpy(name2,per[i].name);a = per[i].size;}}printf("%s took clay from %s.\n",name1,name2);}return 0;}
If you cannot understand it, please leave a message or leave an email !!! O (partition _ partition) o