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 ...
随机推荐
- ip地址分类和网段区分
IP地址分类/IP地址10开头和172开头和192开头的区别/判断是否同一网段 简单来说在公司或企业内部看到的就基本都是内网IP,ABC三类IP地址里的常见IP段. 每个IP地址都包含两部分,即网络号 ...
- Spring Boot 系列教程18-itext导出pdf下载
Java操作pdf框架 iText是一个能够快速产生PDF文件的java类库.iText的java类对于那些要产生包含文本,表格,图形的只读文档是很有用的.它的类库尤其与java Servlet有很好 ...
- 解决getElementsByClassName兼容问题
getElementsByClassName这个方法很常用,但是只有较新的浏览器才兼容,所以我们需要自己写个方法,解决这个问题,使它能够兼容各个浏览器. function getElementsByC ...
- Note_JavaWeb_Jars
- 简单的Android之apk包反编译方法
网上相关的文章一大堆了,我只是总结下自己的反编译方法和工具 工具下载地址: http://download.csdn.net/detail/zsjangel/7104663 下载上面的三个工具的压缩包 ...
- L2-007. 家庭房产
L2-007. 家庭房产 题目链接:https://www.patest.cn/contests/gplt/L2-007 并查集 初学,看这题的时候完全没有什么好的想法,参考了@yinzm的blog用 ...
- AuthenticationManager, ProviderManager 和 AuthenticationProvider
AuthenticationManager是一个接口: public interface AuthenticationManager { Authentication authenticate(Aut ...
- pigcms 微外卖下单加数量bug
bug:加数量的时候结算金钱出现NAN 先给一个简单粗暴的解决办法. 找到/tpl/static/dishout/js/main.js 把 65行 disPrice = parseFloat(sig ...
- 百度JS模板引擎 baiduTemplate 1.0.6 版
A.baiduTemplate 简介 0.baiduTemplate希望创造一个用户觉得“简单好用”的JS模板引擎 注:等不及可以直接点左侧导航中的”C.使用举例“,demo即刻试用. 1.应用场景: ...
- HttpPost与HttpVerbs.Post属性的区别
1. the HttpPost attribute is a short for the HttpVerbs.Post one but since MVC 2.0. 从MVC 2.0之后HttpPos ...