... HAVE U TRIED .... AT LEAST 3 TIMES ... OK U CAN SEE THIS ...
Showing posts with label Contest. Show all posts
Showing posts with label Contest. Show all posts

Friday, January 24, 2014

SPOJ-13208. In Love with Loops

//Problem link>>http://www.spoj.com/problems/KIDZEE1I/

#include <iostream>
using namespace std ;
int main ()
{
    int t , i  , j , k ,cas=1;
    cin>>t ;
    while (cas<=t)
    {
        int x ,y , z ;
        cin>>x>>y>>z ;

        cout<<"Case "<<cas++<<":"<<endl ;


        for (i=0 ; i<=x ;i++)
        {
            for (j=i+1 ; j<=y ; j++)
            {
                for (k=j+1 ; k<=z ; k++)
                {
                    cout<<i<<" "<<j<<" "<<k<<endl ;
                }
            }
        }
    }

    return 0;
}

TIMUS-1409 : Two Gangsters

//problem link>>http://acm.timus.ru/problem.aspx?space=1&num=1409

#include <iostream>
using namespace std ;
int main ()
{
    int a ,b , i ,x ;
    while (cin>>a>>b)
    {
        x=a+b ;
        if (x>10)
        {
            x=x-10 ;
            cout<<b-x<<" "<<a-x<<endl ;
        }
        else   cout<<b-1<<" "<<a-1<<endl ;


    }

    return 0 ;
}