UVa 10176 Ocean Deep ! - Make it shallow !! (模性质)2014-07-07 synapse7 http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1117思路和UVa 11344是一样的,只不过那题是10进制,这题是2进制。完整代码:
01./*0.019s*/02.03.#include<cstdio>04.05.int main()06.{07.int mod;08.char ch;09.while (~(ch = getchar()))10.{11.mod = ch & 15;12.while ((ch = getchar()) != "#")13.{14.if (ch == 10) continue;15.mod = ((mod << 1) + (ch & 15)) % 131071;16.}17.puts(mod ? "NO" : "YES");18.getchar();19.}20.return 0;21.}