Advertisement
Guest User

Untitled

a guest
Jan 12th, 2015
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include <cmath>
  5.  
  6. using namespace std;
  7.  
  8. int a[303]={0}, b;
  9.  
  10. ifstream in("input.txt");
  11. ofstream out("output.txt");
  12.  
  13. void outArray(){
  14. for (int i=a[0];i>0;i--)
  15. out << a[i];
  16. out << endl;
  17. }
  18.  
  19. int main(){
  20.  
  21. a[0]=1;
  22. a[1]=1;
  23.  
  24. in >> b;
  25. for (int j=1; j<=b; j++)
  26. {
  27.  
  28. for (int i=1; i<=a[0]; i++)
  29. a[i] *= 2;
  30.  
  31. for (int i=1; i<=a[0]; i++)
  32. if (a[i] >= 10)
  33. {
  34. a[i+1] += (a[i]-a[i]%10)/10;
  35. a[i] %= 10;
  36. if (a[0]==i)
  37. a[0]++;
  38. }
  39.  
  40. }
  41.  
  42. outArray();
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement