fork download
  1. #include <bits/stdc++.h>
  2. #include <string.h>
  3.  
  4. #define pb push_back
  5. #define mp make_pair
  6. #define F first
  7. #define S second
  8. #define sz(x) (int)x.size()
  9. #define str(x) (int)strlen(x)
  10. #define all(x) x.begin(), x.end()
  11. #define itr ::iterator
  12. #define rt return
  13. #define sf scanf
  14. #define pf printf
  15. #define bit __builtin_popcountll
  16. #define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)
  17. #define SABR inline ll IN(){ll x=0,ch=getchar(),f=1;while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar();if (ch=='-'){f=-1;ch=getchar();}while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}return x*f;}inline void OUT(ll x){if (x<0) putchar('-'),x=-x;if (x>=10) OUT(x/10),putchar(x%10+'0');else putchar(x+'0');}
  18. #define PI 3.14159265358979323846264338327950288419716939937510
  19.  
  20. using namespace std;
  21.  
  22. typedef long long ll;
  23. typedef unsigned uns;
  24. typedef pair <int, int> pi;
  25. typedef vector <int> vi;
  26.  
  27. const int MX = (int) 1e6 + 17;
  28. const int MOD = (int) 1e9 + 7;
  29. const ll LINF = (ll) 1e18 + 7;
  30. const int INF = (int) 999999999;
  31.  
  32.  
  33. SABR
  34.  
  35. int n, k;
  36. string zh;
  37.  
  38. string x, y;
  39.  
  40.  
  41.  
  42. string get(string x, string y)
  43. {
  44. int A = sz(x), B = sz(y), C = A + B;
  45. vector <int> a(A + 100), b(B + 100), c(C + 100);
  46. string ans = "";
  47. /// if (x == "0" || y == "0") {ans = "0"; rt ans;}
  48. int len = sz(x) + sz(y) + 1;
  49. for (int i = sz(x) - 1, j = 0; i >= 0; i--, j++) a[j] = x[i] - 48;
  50. for (int i = sz(y) - 1, j = 0; i >= 0; i--, j++) b[j] = y[i] - 48;
  51.  
  52. for (int i = 0; i < sz(x); i++)
  53. {
  54. for (int j = 0; j < sz(y); j++)
  55. {
  56. c[i + j] += a[i] * b[j];
  57. }
  58. }
  59.  
  60. for (int i = 0; i < len; i++)
  61. {
  62. c[i + 1] += c[i] / 10;
  63. c[i] %= 10;
  64. }
  65. while (c[len] == 0) len--;
  66.  
  67. for (int i = len; i >= 0; i--) ans += (c[i] + '0');
  68. // a.clear(), b.clear(), c.clear();
  69.  
  70. rt ans;
  71. }
  72. int main()
  73. {
  74. cin >> n;
  75.  
  76. if (n == 0) {cout << 1;rt 0;}
  77.  
  78. zh = "1";
  79. for (int i = 1; i <= n; i++)
  80. {
  81. zh = get(zh, "2");
  82. }
  83.  
  84. cout << zh;
  85. rt 0;
  86. }
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
1