import java.util.Scanner;
import java.math.BigInteger;
import java.io.FileReader;
import java.io.IOException;
public class UVa10254 {
public static void main(String[] args)throws IOException {
FileReader fr = new FileReader("inputFile.in");
Scanner input = new Scanner(fr);
while (input.hasNextInt()) {
BigInteger m = new BigInteger("2");
BigInteger now = new BigInteger("1");
int c = 2;
int no = input.nextInt() - 1;
int i = 1;
while (i <= no) {
for (int j = 0; j < c; j++) {
if (i > no)
break;
now = now.add(m);
i++;
}
m = m.multiply(new BigInteger("2"));
c++;
}
System.out.println(now);
}
}
}
- Jun 18 Sat 2016 02:39
[UVa] [10254] [The Priest Mathematician] [JAVA]
close
文章標籤
全站熱搜
留言列表
禁止留言