Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- typedef int nrmare[100005];
- void atrib(nrmare x, int n)
- {
- x[0]=0;
- if(n==0)
- x[(x[0]=1)]=0;
- else
- for(; n; n/=10)
- x[++x[0]]=n%10;
- }
- void sum(nrmare x,nrmare y)
- {
- int t=0;
- y[0]=1;
- for(int i=1;i<=x[0];i++)
- {
- t+=x[i];
- y[y[0]]+=t%10;
- if(t>=10) y[0]++;
- t/=10;
- }
- if(t)
- y[++y[0]]=t;
- }
- int prim(int a)
- {
- if(a<2)
- return 0;
- if(a==2)
- return 1;
- for(int j=2; j*j<=a; j++)
- {
- if(a%j==0)
- return 0;
- }
- return 1;
- }
- void produs(nrmare x, int y)
- {
- int i,t=0;
- for(i=1; i<=x[0]; i++,t/=10)
- {
- t+=x[i]*y;
- x[i]=t%10;
- }
- for(; t; t/=10)
- {
- x[++x[0]]=t%10;
- }
- }
- int ok1=0;
- int n;
- int main()
- {
- int k;
- cin>>k;
- if(k==1)
- cout<<2;
- else
- {
- nrmare summ;
- nrmare z;
- atrib(z,2);
- int rest=k%10;
- int y=k/10;
- int l=1;
- for(int i=1; i<rest; i++)
- l*=2;
- produs(z,l);
- for(int i=1; i<=y; i++)
- produs(z,1024);
- atrib(summ,0);
- sum(z,summ);
- for(int i=summ[0];i>=1;i--)
- cout<<summ[i];
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement