题目连接: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. Microsoft Visual Studio 2012正式版官方下载

    Microsoft Visual Studio 2012正式版官方下载 首先声明,看到园子里还没有类似的新闻,所以斗胆发首页,如有不妥之处,请移除并谅解. 虽然之前已经又用到泄露的MSDN正式版,但今 ...

  2. 淘淘商城_day04_课堂笔记

    今日大纲 实现首页的大广告位功能 实现内容管理系统 首页的大广告 什么是大广告 JS效果: 点击下面的序号选择查询哪个广告 自动切换 点击图片查询具体的页面 以上是由前端团队来开发. 数据结构 说明: ...

  3. Bullcow 牡牛和牝牛(bzoj 3398)

    Description     约翰要带N(1≤N≤100000)只牛去参加集会里的展示活动,这些牛可以是牡牛,也可以是牝牛.牛们要站成一排.但是牡牛是好斗的,为了避免牡牛闹出乱子,约翰决定任意两只牡 ...

  4. Java Swing 日期控件(转载)

    http://www.cnblogs.com/lzy1991/p/5714935.html

  5. geom设置—折线图

    折线图在R中也是很常见的一种图形,相对而言也比较简单. geom_line(mapping = NULL, data = NULL, stat = "identity", posi ...

  6. 安卓访问webAPI,并取回数据

    前言 安卓自从4.0以后,所有的网络访问都需要异步进程操作.其自带的异步类有AsyncTask,Handler,以及可以声明Thread等等.涉及到多进程,必须要提到一个问题,线程与线程之间不能直接进 ...

  7. Android 中执行定时任务 Timer + TimerTask

    1. new Timer().schedule(new TimerTask() { @Override public void run() { //任务代码 } }, 0, 5000);

  8. 二维离散平稳小波重构iswt2

    clc,clear all,close all; load woman; [cA,cH,cV,cD]=swt2(X,2,'haar');%用haar小波基进行2尺度平稳小波分解 Y=iswt2(cA, ...

  9. Maxmum subsequence sum problem

    We have a lot of ways to solve the maximum subsequence sum problem, but different ways take differen ...

  10. LeetCode OJ 154. Find Minimum in Rotated Sorted Array II

    Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed? Would ...