A.uva 12709 Falling ANTS

首先按照H排序,然后按照L*H*W排序 

 1 #include<iostream>
 2 #include<cstdio>
 3 #include <math.h>
 4 #include<algorithm>
 5 #include<string.h>
 6 #define maxn 100009
 7 #define inf 100000
 8 using namespace std;
 9 int main()
10 {
11         int n,a,b,c;
12         while(1)
13         {
14                 int ans=0,ans_h=0;
15                 scanf("%d",&n);
16                 if(n==0)break;
17                 for(int i=1;i<=n;i++)
18                 {
19                         scanf("%d%d%d",&a,&b,&c);
20                         if(c>ans_h)ans_h=c,ans=a*b*c;
21                         else if(c==ans_h && a*b*c>ans)ans=a*b*c;
22                 }
23                 printf("%d\n",ans);
24         }
25         return 0;
26 }
View Code

相关文章:

  • 2022-12-23
  • 2021-04-16
  • 2022-02-01
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-11
  • 2021-09-01
  • 2021-07-09
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
  • 2022-12-23
相关资源
相似解决方案