http://codeforces.com/problemset/problem/676/B
题意:
向高脚杯(是不是高脚杯?)倒酒,一秒钟倒满一杯,问 t 秒后有多少个杯子是满的。
思路:
直接模拟。
Code:
#include<cstdio>
#include<cstring>
const int MYDD=113;
int main() {
int n,t;
while(scanf("%d%d",&n,&t)!=EOF) {
double g[MYDD][MYDD];//glass
g[1][1]=t*1.0;
int ans=0;
for(int j=1; j<=n; j++) {
for(int k=1; k<=j; k++) {
if(g[j][k]>=1.0) {//当前杯子是满的
g[j+1][k]+=(g[j][k]-1)/2.0;//下一层左边
g[j+1][k+1]+=(g[j][k]-1)/2.0;//下一层右边
ans++;
}
}
}
printf("%d\n",ans);
}
return 0;
}
/*By: Shyazhut*/