用位运算符来搞⛏

2的n次方计算

http://www.nowcoder.com/questionTerminal/35a1e8b18658411388bc1672439de1d9

import java.util.*;
public class Main
{
    public static void main(String [] args)
    {
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext())
        {
            int n=sc.nextInt();
            int b=2<<n-1;
            System.out.println(b);
        }
    }
}

全部评论

相关推荐

你背过凌晨4点的八股文么:简历挂了的话会是流程终止,像我一样
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务