#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[i]-'0';
s %= R;
}
if(!s)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}
#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[i]-'0';
s %= R;
}
if(!s)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন