Advertisement
Mohammad_Dipu_Sultan

UVA 10176 Ocean Deep! - Make it shallow!!

Feb 17th, 2021
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.05 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. // #include <iostream>
  3. // #include <cstdio>
  4. // #include <cstdlib>
  5. // #include <algorithm>
  6. // #include <cmath>
  7. // #include <vector>
  8. // #include <set>
  9. // #include <map>
  10. // #include <queue>
  11. // #include <ctime>
  12. // #include <cassert>
  13. // #include <complex>
  14. // #include <string>
  15. // #include <cstring>
  16. // #include <queue>
  17. // #include <bitset>
  18.  
  19. using namespace std;
  20. typedef long long           ll;
  21. typedef unsigned long long  ull;
  22.  
  23. #define ff                  first
  24. #define ss                  second
  25. #define pb                  push_back
  26. #define mp                  make_pair
  27. #define in                  insert
  28. #define vi                  vector< int >
  29. #define vll                 vector< ll >
  30.  
  31.  
  32. #define f0(b)               for(int i=0;i<(b);i++)
  33. #define f00(b)              for(int j=0;j<(b);j++)
  34. #define f1(b)               for(int i=1;i<=(b);i++)
  35. #define f11(b)              for(int j=1;j<=(b);j++)
  36. #define f2(a,b)             for(int i=(a);i<=(b);i++)
  37. #define f22(a,b)            for(int j=(a);j<=(b);j++)
  38. #define RFOR(i,x,y)         for(int i=x;i>=y;i--)
  39. #define unq(v)              sort(all(v)),(v).resize(unique(all(v))-v.begin())
  40. #define all(v)              v.begin(),v.end()
  41. #define rall(v)             v.rbegin(),v.rend()
  42. #define reversed(s)         reverse(s.begin(), s.end())
  43.  
  44. #define testcase            ll t; cin>>t; while (t--)
  45. #define vout(v)             for(int ind=0;ind<v.size();ind++){ cout<<v[ind]; if(ind<v.size()-1) cout<<' '; else cout<<endl;}
  46. #define arrout(arr,i,x,y)   for(int i=x;i<=y;i++){ cout<<arr[i]; if(i<y) cout<<' '; else cout<<endl;}
  47. #define READ()              freopen("input.txt", "r", stdin)
  48. #define WRITE()             freopen("output.txt", "w", stdout)
  49.  
  50. #define sci(n)              scanf("%d",&n)
  51. #define scii(x,y)           scanf("%d %d",&x,&y)
  52.  
  53.  
  54. #define scl(n)              scanf("%lld",&n)
  55. #define scll(x,y)           scanf("%lld %lld",&x,&y)
  56. #define gtl(x)              getline(cin, (x))
  57.  
  58. #define PI                  acos(-1)
  59. #define CLR(x, y)           memset(x, y, sizeof(x))
  60. #define Precision(a)        cout << fixed << setprecision(a)
  61. #define Flame()             ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
  62. #define MAXP                1000006
  63. #define MOD                 1e9+7//10000007
  64. #define EPS                 1e-7
  65.  
  66. template <typename T> T Sqr(T x) { T n = x * x ; return n ;}
  67. template <typename T> T Pow(T B,T P){ if(P==0) return 1; if(P&1) return B*Pow(B,P-1);  else return Sqr(Pow(B,P/2));}
  68. template <typename T> T Abs(T a) {if(a<0)return -a;else return a;}
  69. template <typename T> T Gcd(T a,T b){if(a<0)return Gcd(-a,b);if(b<0)return Gcd(a,-b);return (b==0)?a:Gcd(b,a%b);}
  70. template <typename T> T Lcm(T a,T b) {if(a<0)return Lcm(-a,b);if(b<0)return Lcm(a,-b);return a*(b/Gcd(a,b));}
  71. template <typename T> T BigMod (T b,T p,T m){if (p == 0) return 1;if (p%2 == 0){T s = BigMod(b,p/2,m);return ((s%m)*(s%m))%m;}return ((b%m)*(BigMod(b,p-1,m)%m))%m;}
  72. template <typename T> inline string ToBinary(T n) {string r ;while(n != 0) {r = ( n % 2 == 0 ? "0" : "1" ) + r ; n >>= 1;} return r ;}
  73. long long BinaryToDecimal(string s) {int len = s.size();long long n = 0, p = 1;for (int i = len - 1; i >= 0; i-- , p *= 2) n += p * (s[i] - '0');return n;}
  74.  
  75. int Strtoint(string str){stringstream ss(str);int x = 0;ss >> x ;return x ;}
  76. string Intostr(int x){stringstream ss; ss << x; string str = ss.str(); return str;}
  77.  
  78. #define bug printf("**!\n")
  79. #define D(x)            cerr << __LINE__ << ": " #x " = " << (x) << '\n'
  80. #define DD(x, y)        cerr << __LINE__ << ": " #x " = " << (x) << ", " #y " = " << (y) << '\n'
  81. #define DDD(x, y, z)    cerr << __LINE__ << ": " #x " = " << (x) << ", " #y " = " << (y) << ",  " #z " = " << (z) << '\n'
  82.  
  83. int main()
  84. {
  85.     char s;
  86.     ll x=131071;
  87.     while(cin >> s)
  88.     {
  89.         ll sum=s-'0';
  90.         while(cin >> s)
  91.         {
  92.             if(s=='#') break;
  93.             else
  94.             {
  95.                 sum=((sum<<1)+(s-'0'))%131071;
  96.             }
  97.         }
  98.         if(sum==0) cout << "YES\n";
  99.         else cout << "NO\n";
  100.     }
  101.     return 0;
  102. }
  103.  
  104.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement