Uva 12709 Falling Ants
// ২০১৩ সালে নর্থ সাউথ বিশ্ববিদ্যালয়ে অনুষ্ঠিত ACM-ICPC Regional Contest Problem.
/*
Uva Falling Ants
Verdict : Accepted
Time : 0.009
Problem Link : https://uva.onlinejudge.org/external/127/12709.pdf
= = = = = = = = = = = = = = = =
#include <bits/stdc++.h>
using namespace std;
int main ()
{
int t,l,w,h,maxi,maxv,v,v2;
while (cin >> t and t!=0)
{
maxv = maxi = -1;
while (t--)
{
cin >> l >> w >> h;
if (maxi < h)
{
maxi = h;
v = l*w*h;
maxv = v;
//cout << "vol = " << maxv << " ";
}
else if (maxi == h)
{
maxv = max (maxv,l*w*h);
//cout << "vol = " << maxv << " ";
}
}
cout << maxv << endl;
}
return 0;
}*/
/*
Uva 12709 - Falling Ants
Verdict: Accepted
Time : 0.003
Problem Link : https://uva.onlinejudge.org/external/127/12709.pdf
==> When h is maximum it is sure that volume will be maximum. And when h is equal with another part then find the maximum volume to compare between them. No need to check when h is minimum.
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <cctype>
#include <sstream>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#define sf scanf
#define pf printf
#define sfint scanf ("%d %d",&a,&b)
#define sfl scanf ("%ld %ld",&a,&b)
#define sfll scanf ("%lld %lld",&a,&b)
#define sfd scanf ("%lf %lf",&a,&b)
#define sff scanf ("%f %f",&a,&b)
#define loop (i,n) for (i=0;i<n;i++)
#define LL long long
#define L long
#define nl puts("")
#define N 10000
#define max(a,b) (a>b) ? a : b
#define MOD 10000000007
#define pb push_back
#define pi acos(-1.0)
#define sz size()
#define gc getchar ()
#define ps push
#define clr clear
#define bn begin()
#define ed end()
using namespace std;
int main ()
{
int t,l,w,h,maxi,vol;
while (sf ("%d",&t) == 1 and t)
{
maxi = -1;
while (t--)
{
sf ("%d %d %d",&l,&w,&h);
if (h > maxi)
{
maxi = h;
vol = l*w*h;
}
else if (h == maxi)
{
vol = max (vol, l*w*h);
}
}
pf ("%d\n",vol);
}
return 0;
}
/*
Uva Falling Ants
Verdict : Accepted
Time : 0.009
Problem Link : https://uva.onlinejudge.org/external/127/12709.pdf
= = = = = = = = = = = = = = = =
#include <bits/stdc++.h>
using namespace std;
int main ()
{
int t,l,w,h,maxi,maxv,v,v2;
while (cin >> t and t!=0)
{
maxv = maxi = -1;
while (t--)
{
cin >> l >> w >> h;
if (maxi < h)
{
maxi = h;
v = l*w*h;
maxv = v;
//cout << "vol = " << maxv << " ";
}
else if (maxi == h)
{
maxv = max (maxv,l*w*h);
//cout << "vol = " << maxv << " ";
}
}
cout << maxv << endl;
}
return 0;
}*/
/*
Uva 12709 - Falling Ants
Verdict: Accepted
Time : 0.003
Problem Link : https://uva.onlinejudge.org/external/127/12709.pdf
==> When h is maximum it is sure that volume will be maximum. And when h is equal with another part then find the maximum volume to compare between them. No need to check when h is minimum.
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <cctype>
#include <sstream>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#define sf scanf
#define pf printf
#define sfint scanf ("%d %d",&a,&b)
#define sfl scanf ("%ld %ld",&a,&b)
#define sfll scanf ("%lld %lld",&a,&b)
#define sfd scanf ("%lf %lf",&a,&b)
#define sff scanf ("%f %f",&a,&b)
#define loop (i,n) for (i=0;i<n;i++)
#define LL long long
#define L long
#define nl puts("")
#define N 10000
#define max(a,b) (a>b) ? a : b
#define MOD 10000000007
#define pb push_back
#define pi acos(-1.0)
#define sz size()
#define gc getchar ()
#define ps push
#define clr clear
#define bn begin()
#define ed end()
using namespace std;
int main ()
{
int t,l,w,h,maxi,vol;
while (sf ("%d",&t) == 1 and t)
{
maxi = -1;
while (t--)
{
sf ("%d %d %d",&l,&w,&h);
if (h > maxi)
{
maxi = h;
vol = l*w*h;
}
else if (h == maxi)
{
vol = max (vol, l*w*h);
}
}
pf ("%d\n",vol);
}
return 0;
}
Comments
Post a Comment