import java.math.BigInteger; import java.util.Scanner; public class Main { //都说了输入的是正整数 结果测试数据还是有0 题目有些问题 public static void main(String[] args) { Scanner sc=new Scanner(System.in); BigInteger two=new BigInteger("2"); int n=sc.nextInt(); if(n==0){ System.out.println(1);return;} BigInteger sum=new BigInteger("1"); while(n>1){ if(n%2!=0) sum=sum.multiply(two); two=two.multiply(two); n/=2; } System.out.println(sum.multiply(two)); } }
0.0分
0 人评分
【蟠桃记】 (C语言代码)浏览:651 |
人见人爱A+B (C语言代码)浏览:628 |
C语言程序设计教程(第三版)课后习题9.4 (C语言代码)浏览:667 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:529 |
有关字符,字符串的输入输出函数说明浏览:479 |
C语言程序设计教程(第三版)课后习题10.3 (C语言代码)浏览:1918 |
模拟计算器 (C语言代码)浏览:2300 |
10月月赛题解浏览:536 |
C二级辅导-等差数列 (C语言代码)浏览:770 |
整数分类问题 为什么输出总是数字8啊浏览:442 |