美文网首页
计蒜客题库六

计蒜客题库六

作者: BeefLiu | 来源:发表于2016-12-23 22:54 被阅读0次
#include <iostream>
#include <string>
using namespace std;
int main() {
    int N;
    string *result = new string[100];
    int cc = 0;
    do {
        cin >> N;
        int L,W,H;
        int t_max=-1;
        int t_min=-1;
        string M,maxname,minname;
        for (int i = 0; i < N; i++) {
            cin >> L >> W >> H >> M;
            int temp = L*W*H;
            if(t_min == -1) {
                t_min = temp;
                minname = M;
            }
            if(temp>t_max) {
                t_max = temp;
                maxname = M;
            }
            if(temp<t_min) {
                t_min = temp;
                minname = M;
            }
        }
        if(N!=-1) {
            result[cc] = maxname+string(" took clay from ")+minname+string(".");
            cc++;
        }
    }while(N!=-1);
    for(int i=0;i<100;i++) {
        cout<<result[i]<<endl;
    }
    delete[] result;
    return 0;
}

相关文章

网友评论

      本文标题:计蒜客题库六

      本文链接:https://www.haomeiwen.com/subject/xhhlvttx.html