KarleFKremen

Untitled

May 25th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.81 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define FILE ""
  6. #define FILEIO 0
  7. #define LONG 0
  8. #define IOSOPT 0
  9.  
  10. #if LONG
  11.     typedef long long ll;
  12.     typedef unsigned long long ull;
  13. #else // LONG
  14.     typedef int ll;
  15.     typedef unsigned int ull;
  16. #endif
  17. typedef short sym;
  18. #define pb push_back
  19. #define mp make_pair
  20. #define p(a, b) pair < a, b >
  21. #define rev(a) reverse(a.begin(), a.end())
  22. #define ord(a) sort(a.begin(), a.end())
  23. #define rm erase
  24. #define rs resize
  25. #define sz size
  26. #define fi first
  27. #define se second
  28. #define ins insert
  29. #define die(a) \
  30.     { \
  31.         cout << a << endl; \
  32.         exit(0); \
  33.     }
  34. #define stlprint(a) \
  35.     for(auto _STL_ITER = a.begin(); _STL_ITER != a.end(); _STL_ITER++) \
  36.     { \
  37.         cout << (*_STL_ITER) << ' '; \
  38.     }
  39.  
  40. ll aryph(ll a0, ll n, ll k = 1)
  41. {
  42.     ll an = a0 + k * (n - 1);
  43.     return (((a0 + an) * n) / 2);
  44. }
  45.  
  46. ll a[30][30];
  47.  
  48. main()
  49. {
  50.     #if IOSOPT
  51.         ios_base::sync_with_stdio(0);
  52.         cin.tie(0);
  53.     #endif // IOSOPT
  54.     #if FILEIO
  55.         freopen(FILE".in", "r", stdin);
  56.         freopen(FILE".out", "w", stdout);
  57.     #endif
  58.     ll n, t;
  59.     cin >> n >> t;
  60.     ll two = (1 << 12);
  61.     for(int time = 0; time < t; time++)
  62.     {
  63.         a[0][0] += two;
  64.         if(a[0][0] > two)
  65.         {
  66.             a[1][0] += (two / 2);
  67.             a[1][1] += (two / 2);
  68.             a[0][0] = two;
  69.         }
  70.         for(int i = 1; i < (n - 1); i++)
  71.         {
  72.             for(int j = 0; j < (i + 1); j++)
  73.             {
  74.                 if(a[i][j] > two)
  75.                 {
  76.                     a[i + 1][j] += (a[i][j] - two) / 2;
  77.                     a[i + 1][j + 1] += (a[i][j] - two) / 2;
  78.                     a[i][j] = two;
  79.                 }
  80.             }
  81.         }
  82.     }
  83.     ll cnt = 0;
  84.     for(int i = 0; i < n; i++)
  85.         for(int j = 0; j < (i + 1); j++)
  86.             cnt += (a[i][j] >= two);
  87.     // for(int i = 0; i < n; i++)
  88.     // {
  89.     //  for(int j = 0; j < (i + 1); j++)
  90.     //  {
  91.     //      cout << a[i][j] << ' ';
  92.     //  }
  93.  //        cout << endl;
  94.  
  95.     // }
  96.     cout << cnt << endl;
  97. }
Advertisement
Add Comment
Please, Sign In to add comment