*1037计算2的幂

 1 #include<cstdio>
 2 #include<cmath>
 3 using namespace std;
 4 int main()
 5 {
 6     int n;
 7     double s;
 8     scanf("%d",&n);
 9     s=pow(2,n);
10     printf("%d",int(s));
11 
12     return 0;
13 }

注意2个问题:

1.pow()函数的使用和返回值
2.计算结果是否会超出数据范围
posted @ 2017-12-03 16:14  TFLSNOI  阅读(894)  评论(0编辑  收藏  举报