zoj 1712 Skew Binary
2012-03-21 12:04
337 查看
#include "iostream" #include "stdio.h" #include "string.h" using namespace std; int main() { char input[50]; int num[50], len, i, ans, temp, tag; while (scanf("%s", input)) { memset(num, 0, sizeof(num)); ans = 0, temp = 2, tag = 1; if (strcmp(input, "0") == 0) break; len = strlen(input); for (i = 0; i < len; i++) num[len-i-1] = input[i] - 48; for (i = 0; i < len; i++) { ans += num[i] * (temp - 1); temp *= 2; if (ans > 2147483647) { cout << 2147483647 << endl; tag = 0; break; } } if (tag) cout << ans << endl; } }
相关文章推荐
- ZOJ Problem Set - 1712||Skew Binary
- zoj 1712 Skew Binary(AC100!!泪奔~~~~~!!)
- UVa 575 / ZOJ 1712 / Mid-Central USA 1997 Skew Binary (water ver.&斜二进制)
- uva 575 Skew Binary 吓唬人的超级大水题
- UVA - 575 - Skew Binary (简单数论!)
- zoj 1383 Binary Numbers&&zoj 1491 Climbing Worm(简单)
- 575--Skew Binary
- zoj 3478 Binary Land bfs
- 575 - Skew Binary
- poj 1362 Skew Binary 进制转换
- zoj1712
- UVA - 575 Skew Binary
- hoj 1025 SkewBinary 题解
- 数论uva575-Skew Binary
- UVA575 Skew Binary
- uva 575 Skew Binary(模拟)
- poj 1565 Skew Binary
- UVA 575 Skew Binary 数学的水题
- ZOJ Problem Set–1712 Skew Binary
- UVa 575 Skew Binary 歪斜二进制