简单题

//zoj1712 #include <iostream> #include <string> using namespace std; string st; void work() { int i, l = st.length(), temp = 1, ans = 0; for (i = l - 1; i >= 0; i--) { temp *= 2; ans += (st[i] - '0') * (temp - 1); } cout << ans << endl; } int main() { //freopen("t.txt", "r", stdin); while (getline(cin, st) && st != "0") work(); return 0; }