Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define ull unsigned long long
- const int base = 10;
- void solve() {
- string s;
- int n;
- cin >> n;
- vector<int> a;
- s = "1";
- //--------
- //read long num
- for (int i = s.size() - 1; i >= 0; i--) {
- a.push_back(s[i] - '0');
- }
- //multiplication
- for (int j = 0; j < n; j++) {
- int carry = 0;
- for (int i = 0; i < a.size() || carry; i++) {
- if (i == a.size()) {
- a.push_back(0);
- }
- int cur = a[i] * 2 + carry;
- a[i] = cur % base;
- carry = cur / base;
- }
- }
- //print num
- for (int i = a.size() - 1; i >= 0; i--) {
- cout << a[i];
- }
- cout << endl;
- }
- int main() {
- solve();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement