B. Pyramid of Glasses
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Mary has just graduated from one well-known University and is now attending celebration party. Students like to dream of a beautiful life, so they used champagne glasses to construct a small pyramid. The height of the pyramid is 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 nglasses.

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.

Each second, Vlad pours to the top glass the amount of champagne equal to the size of exactly one glass. If the glass is already full, but there is some champagne flowing in it, then it pours over the edge of the glass and is equally distributed over two glasses standing under. If the overflowed glass is at the bottom level, then the champagne pours on the table. For the purpose of this problem we consider that champagne is distributed among pyramid glasses immediately. Vlad is interested in the number of completely full glasses if he stops pouring champagne in t seconds.

Pictures below illustrate the pyramid consisting of three levels.

Input

The only line of the input contains two integers 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

Print the single integer — the number of completely full glasses after t seconds.

Examples
input
3 5
output
4
input
4 8
output
6
Note

In the first sample, the glasses full after 5 seconds are: the top glass, both glasses on the second level and the middle glass at the bottom level. Left and right glasses of the bottom level will be half-empty.


把所有的先倒到第一个杯子里,然后如果>1就(x-1)/2分给下面的

//
// main.cpp
// cf676b
//
// Created by Candy on 9/14/16.
// Copyright © 2016 Candy. All rights reserved.
// #include <iostream>
#include <cstdio>
using namespace std;
const int N=;
int n,t,ans=;
double a[N][N];
int main(int argc, const char * argv[]) {
scanf("%d%d",&n,&t);
a[][]=t;
for(int i=;i<=n-;i++){
for(int j=;j<=i;j++){
if(a[i][j]<=) continue;
a[i+][j]+=(a[i][j]-)/;
a[i+][j+]+=(a[i][j]-)/;
}
}
for(int i=;i<=n;i++) for(int j=;j<=i;j++) if(a[i][j]>=) ans++;
printf("%d",ans);
return ;
}

CF 676B Pyramid of Glasses[模拟]的更多相关文章

  1. 【CF 676B Pyramid of Glasses】模拟,递归

    题目链接:http://codeforces.com/problemset/problem/676/B 题意:一个n层的平面酒杯金字塔,如图,每个杯子的容量相同.现在往最顶部的一个杯子倒 t 杯酒,求 ...

  2. codeforces 676B B. Pyramid of Glasses(模拟)

    题目链接: B. Pyramid of Glasses time limit per test 1 second memory limit per test 256 megabytes input s ...

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

    B. Pyramid of Glasses 题目连接: http://www.codeforces.com/contest/676/problem/B Description Mary has jus ...

  4. B. Pyramid of Glasses

    原题链接 B. Pyramid of Glasses Mary has just graduated from one well-known University and is now attendi ...

  5. Pyramid of Glasses(递推)

    Pyramid of Glasses time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  6. Codeforce#354_B_Pyramid of Glasses(模拟)

    题目连接:http://codeforces.com/contest/676/problem/B 题意:给你一个N层的杯子堆成的金字塔,倒k个杯子的酒,问倒完后有多少个杯子的酒是满的 题解:由于数据不 ...

  7. CF 999B. Reversing Encryption【模拟/string reverse】

    [链接]:CF [代码]: #include<bits/stdc++.h> #define PI acos(-1.0) #define pb push_back #define F fir ...

  8. CF #366 DIV2 C. Thor 模拟 queue/stack降低复杂度

    C. Thor time limit per test 2 seconds memory limit per test 256 megabytes input standard input outpu ...

  9. [Codeforces676B]Pyramid of Glasses(递推,DP)

    题目链接:http://codeforces.com/problemset/problem/676/B 递推,dp(i, j)表示第i层第j个杯子,从第一层开始向下倒,和数塔一样的题.每个杯子1个时间 ...

随机推荐

  1. QQ拼音输入法 该到放弃的时候了

    一直使用QQ拼音的纯净版,后来给了搜狗了,纯净版和普通版已经变成同一个版本了... 不过. 不过,2016.03.16更新版本后,重启后居然还弹出这样的窗口: 不知道怎么设置,每次重启后就弹出! 卸载 ...

  2. console命令详解

    Firebug是网页开发的利器,能够极大地提升工作效率. 但是,它不太容易上手.我曾经翻译过一篇<Firebug入门指南>,介绍了一些基本用法.今天,继续介绍它的高级用法. ======= ...

  3. 定时从多个Excel导入数据到SQL数据库

    Scheduling Data Imports in SQL Server Importing data into a SQL Server database isn't really that tr ...

  4. 【Leafletjs】5.L.Control 自定义一个Control

    L.Control 所有leaflet控制的基础类.继承自IControl接口. 你可以这样添加控件: control.addTo(map); // the same as map.addContro ...

  5. 一个插件让你在chrome直接运行apk

    插件的下载地址: https://chrome.google.com/webstore/detail/arc-welder/emfinbmielocnlhgmfkkmkngdoccbadn?utm_s ...

  6. Android自定义ScrollView分段加载大文本数据到TextView

    以下内容为原创,转载时请注明链接地址:http://www.cnblogs.com/tiantianbyconan/p/3311658.html 这是我现在碰到的一个问题,如果需要在TextView中 ...

  7. Android Studio 更换国内源下载依赖库

    我的博客:http://daycoding.com 小小程序猿 由于国内GFW的原因,经常导致android studio 莫名其妙的编译不了,多数原因是由于不能下载依赖库 Gradle支持三种不同的 ...

  8. swift 2.2 语法 (上)

    前言: 1.此文中的语法会根据Swift的升级变动而更新. 2.如果需要请移步 -> swift2.2 语法(中).swift 2.2语法(下) Swift与OC中常见的区别 导入框架 OC: ...

  9. 0. CMMI快乐之旅——内容简介及目录

    摘要: 这是我几年前发表于 www.cmmionline.net 网站(现在升级为www.umlonline.org 网站)数十篇文章,全方位分享了我对CMMI的理解,现我打算整理这些文章陆续在CSD ...

  10. Sql Server之旅——第五站 确实不得不说的DBCC命令(文后附年会福利)

    今天研发中心办年会,晚上就是各自部门聚餐了,我个人喜欢喝干红,在干红中你可以体味到那种酸甜苦辣...人生何尝不是这样呢???正好 ceo从美国带了干红回来,然后我就顺道开心的过了把瘾....一个字.. ...