uva 12709 2013Dhaka A

a,b,c在c最大的情况下选a*b*c最大的

代码如下:

 1 /**************************************************
 2  * Author     : xiaohao Z
 3  * Blog     : http://www.cnblogs.com/shu-xiaohao/
 4  * Last modified : 2014-07-05 21:29
 5  * Filename     : uva_12709.cpp
 6  * Description     : 
 7  * ************************************************/
 8 
 9 #include <iostream>
10 #include <cstdio>
11 #include <cstring>
12 #include <cstdlib>
13 #include <cmath>
14 #include <algorithm>
15 #include <queue>
16 #include <stack>
17 #include <vector>
18 #include <set>
19 #include <map>
20 #define MP(a, b) make_pair(a, b)
21 #define PB(a) push_back(a)
22 
23 using namespace std;
24 typedef long long ll;
25 typedef pair<int, int> pii;
26 typedef pair<unsigned int,unsigned int> puu;
27 typedef pair<int, double> pid;
28 typedef pair<ll, int> pli;
29 typedef pair<int, ll> pil;
30 
31 const int INF = 0x3f3f3f3f;
32 const double eps = 1E-6;
33 const int LEN = 10100;
34 
35 struct P{
36     int a, b, c;
37 }p[LEN];
38 
39 int main()
40 {
41 //    freopen("in.txt", "r", stdin);
42 
43     int n;
44     while(cin >> n && n){
45         int val = 0;
46         for(int i=0; i<n; i++){
47             cin >> p[i].a >> p[i].b >> p[i].c;
48             val = max(val, p[i].c);
49         }
50         int ans = 0;
51         for(int i=0; i<n; i++){
52             if(val == p[i].c){
53                 ans = max(ans, p[i].a*p[i].b*p[i].c);
54             }
55         }
56         cout << ans << endl;
57     }
58     return 0;
59 }
View Code

 

posted @ 2014-07-05 23:19  张小豪  阅读(385)  评论(0编辑  收藏  举报