// http://www.spoj.com/problems/TEAM2/
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
long long int a[4],p;
int j,i=1;
while(scanf("%lld ",&a[0])!=EOF)
{
for(j=1;j<4;j++)
{
scanf("%lld",&a[j]);
}
sort(a,a+4);
p=a[3]+a[2];
printf("Case %d: %lld\n",i,p);
i++;
}
return 0;
}
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
long long int a[4],p;
int j,i=1;
while(scanf("%lld ",&a[0])!=EOF)
{
for(j=1;j<4;j++)
{
scanf("%lld",&a[j]);
}
sort(a,a+4);
p=a[3]+a[2];
printf("Case %d: %lld\n",i,p);
i++;
}
return 0;
}
Can you please proove me your logic .Thanks in advance
ReplyDeletewe need to put four boxes so the maximum length they need would be the sum of lengths of two big boxes :)
Delete