02 January 2015

UVA 11498 - Division of Nlogonia

#include<iostream>
#include<stdio.h>

using namespace std ;
int main()
{
    long int test ;
    while(scanf("%ld",&test)==1)
    {
        if(test==0)
            break ;
        long i ,j ;
        cin>>i>>j ; int cor1 , cor2 ;
        for(int k=1 ; k<=test ; k++)
        {
            cin>>cor1>>cor2 ;
            if((cor1>i)&&(cor2>j))
                cout<<"NE"<<endl ;
            else if((cor1<i)&&(cor2>j))
                cout<<"NO"<<endl ;
              else if((cor1<i)&&(cor2<j))
                cout<<"SO"<<endl ;
                else if((cor1>i)&&(cor2<j))
                    cout<<"SE"<<endl ;
                  else if((cor1==i)||(cor2==j))
                    cout<<"divisa"<<endl ;
        }
    }

    return 0 ;
}

UVA 11172 - Relational Operator


/***
Md. Namzul Hasan
Shahjalal University of Science & technology,sylhet.
hasan08sust@gmail.com
verdict:
***/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cctype>
#include<sstream>
using namespace std ;
typedef long long ll ;
typedef int in ;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;
#define maxi 40000
#define pf printf
#define sc scanf
#define pb push_back
int main()
{
    in test ;
    cin>>test ;
    while(test--)
    {
       ll a,b ;
        cin>>a>>b ;
        if(a>b)
            pf(">\n") ;
        else if(a<b)
            pf("<\n") ;
        else if(a==b)
            pf("=\n") ;
    }

    return 0 ;
}

01 January 2015

UVA 10550 - Combination Lock

#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
using namespace std ;
#define pi 3.1416
#define maximum 1000000
int main()
{
    int a,b,c,d ;
    while(cin>>a>>b>>c>>d)
    {
        int m ;
        if(a==0&&b==0&&c==0&&d==0)
            break ;
        int k=720 ;
        if(a>b)
        {
            m =  ((a-b)*9) ;
        }
        else
            m = 360 - ((b-a)*9) ;
        k = k+m ;
        k= k+360 ;
        if(b>c)
        {
            m =360 -(b-c)*9 ;
        }
        else
            m = (c-b)*9 ;
        k = k+m ;
        if(c>d)
        {
            m = (c-d) *9 ;
        }
        else
        {
            m = 360-((d-c)*9) ;
        }
        k = k+m ;
        printf("%d\n",k) ;
    }
    return 0 ;
}

UVA 272 - TEX Quotes

#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std ;
int main()
{
    char ch ;
    int count = 1 ;
    while(scanf("%c",&ch)==1)
    {
    if(ch=='"')
    {
        if(count%2!=0)
        {
            printf("``") ;

        }
        else if(count%2==0)
        {
            printf("''") ;

        }
        count++ ;
    }
    else
        printf("%c",ch) ;
    }
    return 0 ;
}

UVA 10679 - I Love Strings!!