Codeforce#354_B_Pyramid of Glasses(模拟)
题目连接: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(模拟)的更多相关文章
- codeforces 676B B. Pyramid of Glasses(模拟)
题目链接: B. Pyramid of Glasses time limit per test 1 second memory limit per test 256 megabytes input s ...
- 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 ...
- CF 676B Pyramid of Glasses[模拟]
B. Pyramid of Glasses time limit per test 1 second memory limit per test 256 megabytes input standar ...
- 【CF 676B Pyramid of Glasses】模拟,递归
题目链接:http://codeforces.com/problemset/problem/676/B 题意:一个n层的平面酒杯金字塔,如图,每个杯子的容量相同.现在往最顶部的一个杯子倒 t 杯酒,求 ...
- Codeforce 294A - Shaass and Oskols (模拟)
Shaass has decided to hunt some birds. There are n horizontal electricity wires aligned parallel to ...
- Codeforce 287A - IQ Test (模拟)
In the city of Ultima Thule job applicants are often offered an IQ test. The test is as follows: the ...
- CodeForce 7 B - Memory Manager(模拟)
题目大意:给你一段内存,要你进行如下的三个操作. 1.分配内存 alloc X ,分配连续一段长度为X的内存. 如果内存不够应该输出NULL,如果内存够就给这段内存标记一个编号. 2.擦除编号为 ...
- 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 ...
- Kilani and the Game-吉拉尼的游戏 CodeForce#1105d 模拟 搜索
题目链接:Kilani and the Game 题目原文 Kilani is playing a game with his friends. This game can be represente ...
随机推荐
- 调试技术(/proc、/sys、/dev、strace)
一.在/proc中实现文件 当某个进程读取我们的/proc文件时,内核会分配一个内存页,即PAGE_SIZE字节的内存块.驱动程序可以将数据通过这个内存页返回到用户空间. 第一种方法,不采用seq_f ...
- UIView 和 CALayer 的区别和联系
UIView是在/System/Library/Frameworks/UIKit.framework定义,也就是处于Cocoa Touch层. CALyer是在/System/Library/Fram ...
- android 操蛋的gradle
首先看语法: -include {filename} 从给定的文件中读取配置参数 -basedirectory {directoryname} 指定基础目录为以后相对的档案名称 -injars {cl ...
- PHP高效获取远程图片尺寸和大小
/** * 获取远程图片的宽高和体积大小 * * @param string $url 远程图片的链接 * @param string $type 获取远程图片资源的方式, 默认为 curl 可选 f ...
- CodeForces 702E Analysis of Pathes in Functional Graph
倍增预处理. 先看一下这张图的结构,因为出度都是$1$,所以路径是唯一的,又因为每个点都有出度,所以必然有环,也就是一直可以走下去. 接下来我们需要记录一些值便于询问: 设$t[i][j]$表示从$i ...
- display:inline-block和float:left的选择
参考文章: http://www.zhangxinxu.com/wordpress/2010/11/%E6%8B%9C%E6%8B%9C%E4%BA%86%E6%B5%AE%E5%8A%A8%E5%B ...
- 2016弱校联盟十一专场10.2——Floyd-Warshall
题目链接:Floyd-Warshall 题意: 给你n个点,m条边,100>m-n>0,现在有q个询问,问你任意两点的最短距离,题目保证每条边都被连接,每条边的距离为1 题解: 首先我们可 ...
- Haskell开始
一.安装 操作系统为centos,为了安装最新的Haskell编译器,不使用命令 yum install ghc 1.安装ghc 使用wget下载ghc,命令如下(注意系统是centos6.7) $ ...
- React - Stores
Event emmiters that make data available, handle business logic, send events to React, and listen for ...
- 11.hibernate的连接查询
1.创建如下javaweb项目结构 2.在项目的src下创建hibernate.cfg.xml主配置文件 <?xml version="1.0" encoding=" ...