题目连接:http://codeforces.com/contest/676/problem/B

题意:给你一个N层的杯子堆成的金字塔,倒k个杯子的酒,问倒完后有多少个杯子的酒是满的

题解:由于数据不是很大,直接模拟就行了

 #include<cstdio>
#include<cstring>
#define F(i,a,b) for(int i=a;i<=b;++i) double a[][],eps=1e-,p;int n,k,ans; void fuck(){
a[][]+=;
F(i,,n-)F(j,,i)
if(a[i][j]->eps)p=a[i][j]-,a[i][j]=,a[i+][j]+=p/,a[i+][j+]+=p/;
} int main(){
while(~scanf("%d%d",&n,&k)){
memset(a,,sizeof(a));
F(i,,k)fuck();ans=;
F(i,,n)F(j,,i)if(a[i][j]>-eps)ans++;
printf("%d\n",ans);
}
return ;
}

Codeforce#354_B_Pyramid of Glasses(模拟)的更多相关文章

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

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

  2. 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 ...

  3. CF 676B Pyramid of Glasses[模拟]

    B. Pyramid of Glasses time limit per test 1 second memory limit per test 256 megabytes input standar ...

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

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

  5. Codeforce 294A - Shaass and Oskols (模拟)

    Shaass has decided to hunt some birds. There are n horizontal electricity wires aligned parallel to ...

  6. Codeforce 287A - IQ Test (模拟)

    In the city of Ultima Thule job applicants are often offered an IQ test. The test is as follows: the ...

  7. CodeForce 7 B - Memory Manager(模拟)

    题目大意:给你一段内存,要你进行如下的三个操作. 1.分配内存  alloc   X ,分配连续一段长度为X的内存. 如果内存不够应该输出NULL,如果内存够就给这段内存标记一个编号. 2.擦除编号为 ...

  8. CodeForce 439C Devu and Partitioning of the Array(模拟)

     Devu and Partitioning of the Array time limit per test 1 second memory limit per test 256 megabytes ...

  9. Kilani and the Game-吉拉尼的游戏 CodeForce#1105d 模拟 搜索

    题目链接:Kilani and the Game 题目原文 Kilani is playing a game with his friends. This game can be represente ...

随机推荐

  1. jQuery ajax调用后台aspx后台文件的两种常见方法(不是ashx)

    在asp.net webForm开发中,用Jquery ajax调用aspx页面的方法常用的有两种:下面我来简单介绍一下. [WebMethod] public static string SayHe ...

  2. centos7 安装nodejs,git

    yum -y install gcc make gcc-c++ openssl-devel wget 下载源码及解压: wget http://nodejs.org/dist/v0.10.26/nod ...

  3. eclipse保存时自动格式化代码和优化导包

  4. Linux_Cytoscape

  5. ARM驱动调试方法、思路总结、笔记

    驱动程序的调试一. 打印: prink, 自制proc文件UBOOT传入console=ttySAC0 console=tty11. 内核处理UBOOT传入的参数console_setup add_p ...

  6. MQ队列堆积太长,消费不过来怎么办(转)

    转自:http://windwrite.com/archives/603 我们现有的业务就面临此问题,消息生产太快,消费不过来,导致队列堆积很长,把服务器内存耗尽,这时RabbitMQ的处理能力很低下 ...

  7. 投票项目-bootstrap

    <script id="src" type="text/tmpl"> //script标签的type写成这个,浏览器会认为他不是javascript ...

  8. Html批量读取json

    html <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <sc ...

  9. sublime eslint setup

    [Setting Up ESLint] https://www.youtube.com/watch?v=QUK4hMoYv_c

  10. 安卓---achartengine图表----简单调用----使用view显示在自己的布局文件中----actionBar的简单设置

    AChartEngine 是一个安卓系统上制作图表的框架,关于它的介绍大家可以百度,也可以参考下面这篇博客http://blog.csdn.net/lk_blog/article/details/76 ...