Guest User

Untitled

a guest
May 25th, 2016
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <algorithm>
  4. #include <vector>
  5. #include <cstring>
  6. #include <deque>
  7. #include <stack>
  8. #include <stdio.h>
  9. #include <map>
  10. #include <set>
  11. #include <time.h>
  12. #include <string>
  13. #include <fstream>
  14. #include <queue>
  15. #include <bitset>
  16. #include <cstdlib>
  17. #define X first
  18. #define Y second
  19. #define mp make_pair
  20. #define pb push_back
  21. #define pdd pair<double,double>
  22. #define pii pair<ll,ll>
  23. #define PI 3.14159265358979323846
  24. #define MOD 1000000007
  25. #define MOD2 1000000009
  26. #define INF (1LL+(ll)1e+15)
  27. #define x1 fldgjdflgjhrthrl
  28. #define x2 fldgjdflgrtyrtyjl
  29. #define y1 fldggfhfghjdflgjl
  30. #define y2 ffgfldgjdflgjl
  31. #define N 100500
  32. #define mx 112
  33. #define sqval 1000
  34. #define eps 1e-9
  35. #define BLACK 0
  36. #define WHITE 1
  37. #define MAG 1000
  38. typedef long long ll;
  39. typedef long double ld;
  40. using namespace std;
  41. ll n,m,a[15][15],i,j,k,l,x,y,z;
  42. int main() {
  43. //freopen("input.txt","r",stdin);
  44. //freopen("output.txt","w",stdout);
  45. cin >> n >> m;
  46. m *= 1024;
  47. a[0][0] = m;
  48. for (i = 0; i < n; i++)
  49. {
  50. for (j = 0; j <= i; j++)
  51. {
  52.  
  53. if (a[i][j] >= 1024)
  54. {
  55. k++;
  56.  
  57. a[i][j] -= 1024;
  58. }
  59. a[i+1][j] += a[i][j]/2;
  60. a[i+1][j+1] += a[i][j]/2;
  61. }
  62. }
  63. cout << k << endl;
  64. return 0;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment