Pabon_SEC

Ocean Deep! - Make it shallow!!

Mar 7th, 2016
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #define mod 131071
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     char c;
  9.  
  10.     long long num=0;
  11.  
  12.     while((c=getchar())!=EOF)
  13.     {
  14.         if(c=='#')
  15.         {
  16.             printf("%s\n",num?"NO":"YES");
  17.  
  18.             num = 0;
  19.  
  20.             continue;
  21.         }
  22.  
  23.         if(c!=' ' && c!='\n')
  24.         {
  25.             num = (2*num+(c-48))%mod;
  26.         }
  27.  
  28.     }
  29.  
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment