Advertisement
a53

bile1

a53
Jul 9th, 2017
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <fstream>
  2.  
  3. using namespace std;
  4. ifstream cin("bile1.in");
  5. ofstream cout("bile1.out");
  6. typedef unsigned short int NrMare[10010];
  7. NrMare y;
  8.  
  9. void AtribMic(NrMare x, int n)
  10. {
  11. // x=n;
  12. x[0]=0;
  13. if(n==0)
  14. x[(x[0]=1)]=0;
  15. else
  16. for(;n;n/=10)
  17. x[++x[0]]=n%10;
  18. }
  19.  
  20. void ProdusMic(NrMare x, int n)
  21. //x <- x*n
  22. {
  23. int i,t=0;
  24. for(i=1;i<=x[0];i++,t/=10)
  25. {
  26. t+=x[i]*n;
  27. x[i]=t%10;
  28. }
  29. for(;t;t/=10)
  30. x[++x[0]]=t%10;
  31. }
  32.  
  33. void AfisezMare(NrMare x)
  34. // afisez x
  35. {
  36. int i;
  37. for(i=x[0];i>=1;i--)
  38. cout<<x[i];
  39. }
  40.  
  41. int n;
  42. int main()
  43. {
  44. cin>>n;
  45. AtribMic(y,1);
  46. for(int i=1;i<n;i++)
  47. ProdusMic(y,2); // y=y*x;
  48. ProdusMic(y,3);
  49. AfisezMare(y);
  50. return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement