思路:模拟一下就可以了


#include<bits\stdc++.h>
using namespace std;
int n,t;
double a[15][15];
void work()
{
	a[1][1]+=1;
	for(int i = 1;i<=n;i++)
	{
		for(int j = 1;j<=i;j++)
		{
			if(a[i][j]<=1)
				continue;
			double p = a[i][j]-1;
			a[i][j]=1;
			a[i+1][j]+=p/2;
			a[i+1][j+1]+=p/2;
		}
	}
}
int main()
{
     scanf("%d%d",&n,&t);
	 for(int i = 1;i<=t;i++)
		 work();
	 int ans = 0;
	 for(int i = 1;i<=n;i++)
	 {
		 for(int j = 1;j<=i;j++)
		 {
			 if(a[i][j]>=0.9999)
				 ans++;
		 }
	 }
	 printf("%d\n",ans);
}






B. Pyramid of Glasses



time limit per test



memory limit per test



input



output



n. The top level consists of only 1 glass, that stands on 2 glasses on the second level (counting from the top), then 3 glasses on the third level and so on.The bottom level consists of n

Vlad has seen in the movies many times how the champagne beautifully flows from top levels to bottom ones, filling all the glasses simultaneously. So he took a bottle and started to pour it in the glass located at the top of the pyramid.

t

Pictures below illustrate the pyramid consisting of three levels.



Codeforces Round #354 (Div. 2) B Pyramid of Glasses(模拟)_sed

Codeforces Round #354 (Div. 2) B Pyramid of Glasses(模拟)_i++_02



Input



n and t (1 ≤ n ≤ 10, 0 ≤ t ≤ 10 000) — the height of the pyramid and the number of seconds Vlad will be pouring champagne from the bottle.



Output



t



Examples



input



3 5



output



4



input



4 8



output



6



Note



5