14 条题解
-
1
#include<bits/stdc++.h> #include<cstring> #include<queue> #include<set> #include<stack> #include<vector> #include<map> #define ll long long using namespace std; const int N=1e5+10; const int M=2023; const int inf=0x3f3f3f3f; //快速幂 ll n; ll power(ll a,ll b,ll p) { ll ans=1,wq=a; while(b) { if(b & 1)ans=ans*wq; wq=wq*wq; b>>=1;//删掉最后一位 } return ans; } int main() { cin>>n; cout<<power(2,n,inf); return 0; }
快速幂
-
0
#include <iostream> #include <stack> #include <cmath> #include <vector> #include <string.h> #include <queue> #include <stdio.h> #include <iomanip> #include <cstdio> #include <algorithm> #define int long long using namespace std; const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; signed main() { int n; cin >> n; cout << (1 << n); return 0; }
可以试试位运算
- 1
信息
- ID
- 826
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 4
- 标签
- 递交数
- 761
- 已通过
- 361
- 上传者