LightOj 1354 IP Checking







#include <bits/stdc++.h>
using namespace std;

long long int decimal(long long int x)
{
    long long int sum=0,r,k=0;
    while(x>0)
    {
        r=x%10;
        sum=sum+r*pow(2,k);
        x=x/10;
        k++;
    }
    return sum;

}


int main()
{
    long long int a,b,c,d,e,f,g,h,t,i,j;
    char s;
    cin>>t;
    for(i=1;i<=t;i++)
    {
        cin>>a>>s>>b>>s>>c>>s>>d;
        cin>>e>>s>>f>>s>>g>>s>>h;

        if(a==decimal(e) && b==decimal(f) && c==decimal(g) && d==decimal(h))
        {
            printf("Case %lld: Yes\n",i);
        }
        else
        {
             printf("Case %lld: No\n",i);
        }

    }
    return 0;

}




Share on Google Plus

About Ashadullah Shawon

I am Ashadullah Shawon. I am a Software Engineer. I studied Computer Science and Engineering (CSE) at RUET. I Like To Share Knowledge. Learn More: Click Here
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment