Author: loop3r
Date: 20260207
tag: 高精度
link: http://ybt.ssoier.cn:8088/problem_show.php?pid=1170问题描述
分析
略
参考代码
cpp
#include <bits/stdc++.h>
using namespace std;
vector<int> mul(vector<int>& a, int x) {
vector<int> c;
int t =0;
for (int i = 0; i < a.size(); i++) {
t = a[i] * x + t;
c.push_back(t % 10);
t /= 10;
}
while (t) {
c.push_back(t % 10);
t /= 10;
}
return c;
}
vector<int> mpow(int x, int y) {
vector<int> ans;
ans.push_back(1);
for (int i = 1; i <= y; i++) {
ans = mul(ans, x);
}
return ans;
}
int main() {
int n; cin >> n;
vector<int> ans = mpow(2, n);
for (int i = ans.size() - 1; i >= 0; i--) cout << ans[i];
cout << endl;
return 0;
}