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 ...
随机推荐
- jquery正则常用的
jQuery.validator.addMethod("mobilePhone",function(value,element){ return this.optional(ele ...
- JAVA类与对象(课堂总结)
一:"=="的不同含义 当"=="施加于原始数据类型变量时,是比较变量所保存的数据是否相等当"=="施加于引用类型变量时,是比较这两个变量是 ...
- js、jquery的入口函数及其执行与图片加载的先后顺序
js的入口函数写法: window.onload = function() { }; 如果文件中有多个window.onload入口函数,则只会执行最后一个,之前的入口函数没有用. jquery的入口 ...
- 第二次讨论——响应式设计、布局技巧、css性能优化、css预处理
第二次讨论 [响应式设计] 集中创建页面的图片排版大小,可以智能地根据用户行为以及使用的设备环境(系统平台.屏幕尺寸.屏幕定向等)进行相对应的布局. 响应式布局: meta标签的实用:设置布局宽度等于 ...
- Docker 安装及问题处理
1 确定Linux版本 uname -r 2 升级系统(添加 APT 镜像源,添加使用 HTTPS 传输的软件包以及 CA 证书.) sudo apt-get update sudo apt-get ...
- mysql innodb存储引擎和myisam引擎
InnoDb存储引擎面向在线事务处理,其特点是行锁设计.支持外键.并支持Oricle似得非锁定读(所谓非锁定读是如果数据库实例读取的行正在进行更新或删除操作当前读取不会等待当前锁的释放而是读取当前行的 ...
- openstack私有云布署实践【14.1 登录页dashboard-controller(科兴环境)】
2台kxcontroller安装组件 # yum install openstack-dashboard -y 修改一样的配置 vi /etc/openstack-dashboard/local_ ...
- Shell错误[: missing `]'
shell 文件运行时出现错误: [: missing `]' 原因可能是 if [ ! -d $date] then mkdir ./$date fi 代码中的 ] 方括号内部必须要有个空格 ...
- 计算机网络课程优秀备考PPT之第三章数据链路层(三)
为了记录自己从2016.9~2017.1的<计算机网络>助教生涯,也为了及时梳理和整写笔记! 前期博客是, 计算机网络课程优秀备考PPT之第一章概述(一) 计算机网络课程优秀备考PPT之第 ...
- 第七十六节,css颜色和透明度,盒子阴影和轮廓,光标样式
css颜色和透明度,盒子阴影和轮廓,光标样式 学习要点: 1.颜色和透明度 2.盒子阴影和轮廓 3.光标样式 一.颜色和透明度 颜色我们之前其实已经用的很多了,比如字体颜色.背景颜色.边框颜色.但除了 ...