[CCCC-GPLT] L1-012 计算指数 (5分)

    科技2022-09-11  116

    真的没骗你,这道才是简单题 —— 对任意给定的不超过 10 的正整数 n,要求你输出 2​n。不难吧?

    Input Specification:

    输入在一行中给出一个不超过 10 的正整数 n。

    Output Specification:

    在一行中按照格式2^n^ = 计算结果输出 2​n的值。

    Sample Input:

    5

    Sample Output:

    2^5 = 32

    Code:

    #include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int res; res=pow(2,n); cout<<"2^"<<n<<" = "<<res; return 0; }
    Processed: 0.012, SQL: 9