Advertisement
Guest User

Untitled

a guest
May 25th, 2016
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. #include<iostream>
  2. #include<cstdio>
  3. #include<cassert>
  4. #include<cstring>
  5. #include<ctime>
  6. #include<cstdlib>
  7. #include<cmath>
  8. #include<string>
  9. #include<sstream>
  10. #include<map>
  11. #include<set>
  12. #include<queue>
  13. #include<stack>
  14. #include<vector>
  15. #include<bitset>
  16. #include<algorithm>
  17.  
  18. #define pb push_back
  19. #define ppb pop_back
  20. #define mp make_pair
  21. #define all(x) (x).begin(),(x).end()
  22. #define sz(x) (int)(x).size()
  23. #define ll long long
  24. #define bit __builtin_popcountll
  25. #define sqr(x) (x) * (x)
  26. #define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)
  27. #define debug(x) cout << #x <<" = " << x << endl
  28. #define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
  29. #define printvpair(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i].first <<" " << v[i].second << endl;
  30. #define printv(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i] << " "; cout << endl;
  31.  
  32. using namespace std;
  33.  
  34. typedef pair<int, int> pii;
  35.  
  36. const double eps = 1e-9;
  37. const double pi = acos(-1.0);
  38. const int INF = 1000000000;
  39.  
  40. const int dx[4] = {0, 0, 1, -1};
  41. const int dy[4] = {1, -1, 0, 0};
  42.  
  43. const int N = 11;
  44. double a[N][N];
  45. int main() {
  46. ios_base::sync_with_stdio(0);
  47. int n,t;
  48.  
  49. cin >> n >> t;
  50.  
  51. for(int i = 0; i < t; i++){
  52. a[0][0]++;
  53. for(int j = 0; j < n; j++){
  54. for(int k = 0; k <= j; k++){
  55. if (a[j][k] > 1){
  56. double extra = a[j][k] - 1;
  57. a[j][k] -= extra;
  58. a[j + 1][k] += extra / 2;
  59. a[j + 1][k + 1] += extra / 2;
  60. }
  61. }
  62. }
  63. }
  64.  
  65. int ans = 0;
  66. for(int j = 0; j < n; j++){
  67. for(int k = 0; k <= j; k++){
  68. if (a[j][k] == 1)
  69. ans++;
  70. }
  71. }
  72.  
  73. cout << ans << endl;
  74. return 0;
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement