import java.io.IOException;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.Scanner;
import java.util.Formatter;
class Main
{
public static final boolean DEBUG = false;
public static void main(String[] args) throws IOException
{
Scanner cin;
String s;
if (DEBUG) {
cin = new Scanner(new FileReader("d:\\OJ\\uva_in.txt"));
} else {
cin = new Scanner(new InputStreamReader(System.in));
}
while (cin.hasNext()) {
s = cin.next();
if (s.compareTo("0") == 0) break;
double sum = 0;
for (int i = s.length() - 1; i >= 0; i--) {
char ch = s.charAt(i);
if (ch != '0') {
sum += (ch - '0') * (Math.pow(2, s.length() - i) - 1);
}
}
Formatter fmt = new Formatter();
fmt.format("%.0f", sum);
System.out.println(fmt);
}
}
}
题目1129:Skew数
最新推荐文章于 2021-03-10 21:59:44 发布