Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstdio>
- #include<cassert>
- #include<cstring>
- #include<ctime>
- #include<cstdlib>
- #include<cmath>
- #include<string>
- #include<sstream>
- #include<map>
- #include<set>
- #include<queue>
- #include<stack>
- #include<vector>
- #include<bitset>
- #include<algorithm>
- #define pb push_back
- #define ppb pop_back
- #define mp make_pair
- #define all(x) (x).begin(),(x).end()
- #define sz(x) (int)(x).size()
- #define ll long long
- #define bit __builtin_popcountll
- #define sqr(x) (x) * (x)
- #define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)
- #define debug(x) cout << #x <<" = " << x << endl
- #define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
- #define printvpair(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i].first <<" " << v[i].second << endl;
- #define printv(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i] << " "; cout << endl;
- using namespace std;
- typedef pair<int, int> pii;
- const double eps = 1e-9;
- const double pi = acos(-1.0);
- const int INF = 1000000000;
- const int dx[4] = {0, 0, 1, -1};
- const int dy[4] = {1, -1, 0, 0};
- const int N = 11;
- double a[N][N];
- int main() {
- ios_base::sync_with_stdio(0);
- int n,t;
- cin >> n >> t;
- for(int i = 0; i < t; i++){
- a[0][0]++;
- for(int j = 0; j < n; j++){
- for(int k = 0; k <= j; k++){
- if (a[j][k] > 1){
- double extra = a[j][k] - 1;
- a[j][k] -= extra;
- a[j + 1][k] += extra / 2;
- a[j + 1][k + 1] += extra / 2;
- }
- }
- }
- }
- int ans = 0;
- for(int j = 0; j < n; j++){
- for(int k = 0; k <= j; k++){
- if (a[j][k] == 1)
- ans++;
- }
- }
- cout << ans << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement