1. 程式人生 > 其它 >poj 1547(水題)

poj 1547(水題)

#include<iostream>
#include<cstdio>
using namespace std;
int main(){
    int n,maxv,maxi,minv,mini,a,b,c,v;
    char data[10][10];
    while(scanf("%d",&n)==1&&n!=-1){
        maxv = -1;
        minv = 1000;
        for(int i=0;i<n;i++){
            scanf("%d%d%d",&a,&b,&c);
            scanf(
"%s",data[i]); v = a*b*c; if(maxv<v){ maxv = v; maxi = i; } if(minv>v){ minv = v; mini = i; } } printf("%s took clay from %s.\n",data[maxi],data[mini]); }
return 0; }#include<iostream> #include<cstdio> using namespace std; int main(){ int n,maxv,maxi,minv,mini,a,b,c,v; char data[10][10]; while(scanf("%d",&n)==1&&n!=-1){ maxv = -1; minv = 1000; for(int i=0;i<n;i++){ scanf("%d%d%d",&a,&b,&c); scanf(
"%s",data[i]); v = a*b*c; if(maxv<v){ maxv = v; maxi = i; } if(minv>v){ minv = v; mini = i; } } printf("%s took clay from %s.\n",data[maxi],data[mini]); } return 0; }