poj 1547(水题)
作者:互联网
#include<iostream> using namespace std; int main(){ int n; int x,y,z,data[10]; char name[10][10]; int maxv,minv,maxi,mini; while(scanf("%d",&n)==1&&n!=-1){ maxv = -1; minv = 9999; for(int i=0;i<n;i++){ scanf("%d%d%d%s",&x,&y,&z,name[i]); data[i] = x*y*z; if(data[i]>maxv){ maxv = data[i]; maxi = i; } if(data[i]<minv){ minv = data[i]; mini = i; } } printf("%s took clay from %s.\n",name[maxi],name[mini]); } return 0; }
标签:1547,水题,10,int,maxv,maxi,poj,data,minv 来源: https://www.cnblogs.com/stevenzrx/p/15531896.html