here is only basic implementation of problems for beginners. If you have any problem with any solution or any basic concept of programming or you want more efficient solution you can mail me.
my suggestion is not to copy and paste codes from here try to understand the logic and think why you were not able to solve it.

Wednesday 24 September 2014

Spoj a famous icpc team

// 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;
}



2 comments:

  1. Can you please proove me your logic .Thanks in advance

    ReplyDelete
    Replies
    1. we need to put four boxes so the maximum length they need would be the sum of lengths of two big boxes :)

      Delete