Just another WordPress.com site

Problem Statement :

      Go to This link http://uva.onlinejudge.org/external/101/10176.html

 

Discussion for Solution :

        1. As it is a part of Problem no 10551 you may see that post in this link: https://acmproblemsolver.wordpress.com/2012/08/07/solution-of-acm-uva-10551-basic-remains/

 

—————————————————————————————————————————————————————–

 

Code:

 #include<cmath>
#include<iostream>
#include<string>
#include<cstdio>
using namespace std;

int main()
{
    char ch;
    int i,s,R=131071;
    while(1)
    {
        string p=””;
        for(i=0;;i++)
        {
            if(scanf(” %c”,&ch)==EOF)
                return 0;
            else if( ch ==’#’)
                break;
            else
                p+=ch;
        }
        s=0;
        for (int i=0;i<p.length(); i++)
        {
            s *= 2;
            s += p.at(i)-‘0’;
            s %= R;
        }
        if(!s)
            cout<<“YES”<<endl;
        else
            cout<<“NO”<<endl;
    }
    return 0;
}

 

Comments on: "Solution of ACM UVA 10176 – Ocean Deep ! – Make it shallow !!" (2)

  1. Hello! I know this is kinda off topic but I was wondering if you knew where I
    could find a captcha plugin for my comment form?
    I’m using the same blog platform as yours and I’m having trouble
    finding one? Thanks a lot!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: