codeforces 676B 模拟 递推
题意:每秒从最高处的杯子倒一杯酒下来,酒流的方式如图,问t秒装满酒的杯子的数目。
思路:把第一杯的值设为t,glass[i][j]=(glass[i-1][j-1]-1)/2+(glass[i-1][j])/2,统计值大于等于1的杯数。


#include<cstdio>
double glass[][];
int main() {
int n,t;
scanf("%d%d",&n,&t);
glass[][]=t;
for(int i=;i<=n;i++) {
for(int j=;j<=n;j++) {
if(glass[i-][j-]>) glass[i][j]+=(glass[i-][j-]-)/2.0;
if(glass[i-][j]>) glass[i][j]+=(glass[i-][j]-)/2.0;
}
}
int cnt=;
for(int i=;i<=n;i++) {
for(int j=;j<=n;j++) {
if(glass[i][j]>=) cnt++;
}
}
printf("%d\n",cnt);
return ;
}
codeforces 676B 模拟 递推的更多相关文章
- AtCoder Regular Contest 069 D - Menagerie 枚举起点 模拟递推
arc069.contest.atcoder.jp/tasks/arc069_b 题意:一堆不明身份的动物排成一圈,身份可能是羊或狼,羊一定说实话,狼一定说假话.大家各自报自己的两边是同类还是不同类, ...
- [luoguP1011] 车站(递推)
传送门 蒟蒻我关系式没有找出来. 直接模拟递推过程好了. 代码 #include <cstdio> #define N 21 int a, n, m, x, y; int up[N][2] ...
- codeforces D. Queue 找规律+递推
题目链接: http://codeforces.com/problemset/problem/353/D?mobile=true H. Queue time limit per test 1 seco ...
- Codeforces Round #271 (Div. 2) D. Flowers (递推)
题目链接:http://codeforces.com/problemset/problem/474/D 用RW组成字符串,要求w的个数要k个连续出现,R任意,问字符串长度为[a, b]时,字符串的种类 ...
- codeforces 735C Tennis Championship(贪心+递推)
Tennis Championship 题目链接:http://codeforces.com/problemset/problem/735/C ——每天在线,欢迎留言谈论. 题目大意: 给你一个 n ...
- Coconuts, Revisited(递推+枚举+模拟)
Description The short story titled Coconuts, by Ben Ames Williams, appeared in the Saturday Evening ...
- [递推+矩阵快速幂]Codeforces 1117D - Magic Gems
传送门:Educational Codeforces Round 60 – D 题意: 给定N,M(n <1e18,m <= 100) 一个magic gem可以分裂成M个普通的gem ...
- Codeforces Round #260(div2)C(递推)
有明显的递推关系: f[i]表示i为数列中最大值时所求结果.num[i]表示数i在数列中出现了几次. 对于数i,要么删i,要么删i-1,只有这两种情况,且子问题还是一样的思路.那么很显然递推一下就行了 ...
- 递推 Codeforces Round #186 (Div. 2) B. Ilya and Queries
题目传送门 /* 递推:用cnt记录前缀值,查询区间时,两个区间相减 */ #include <cstdio> #include <algorithm> #include &l ...
随机推荐
- hdu5399
题意:给你m行个长度为 n的序列或者-1 -1代表这一行的序列不确定,然后让你找出有多少种情况满足对于每一个i 有f1(f2(⋯fm(i)))=i: 思路:分为三种情况:1,每行序列中有反复数输出0: ...
- nginx內建模块使用
目录 nginx內建模块使用 1. 內建模块的引入 1.1 查看安装信息 1.2 重新指定配置信息 2. 內建模块的使用 2.1 http_stub_status_module 2.2 http_ra ...
- GO语言使用开源SSH模拟终端
<pre name="code" class="plain">package main import ( "go-ssh/ssh" ...
- win10--vs2015--libjpeg--64位库的编译过程记录
win10--vs2015--libjpeg--64位库的编译过程记录 1. 下载源代码: http://libjpeg.sourceforge.net/ 或者 http://www.ij ...
- Unicode utf8等编码类型的原理
1.ASCII码 我们知道,在计算机内部,所有的信息最终都表示为一个二进制的字符串.每一个二进制位(bit)有0和1两种状态,因此八个二进制位就可以组合出256种状态,这被称为一个字节(byte). ...
- yaffs2在am335x上实施
一.yaffs2文件烧写(通过网口) uboot下输入如下命令: setenv ipaddr 192.168.2.110;setenv serverip 192.168.2.222;saveenv n ...
- Currency Exchange - poj 1860
Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 22111 Accepted: 7986 Description Seve ...
- nginx与apache的区别
Web服务器 Web服务器也称为WWW(WORLD WIDE WEB)服务器,主要功能是提供网上信息浏览服务. 应用层使用HTTP协议. HTML文档格式. 浏览器统一资源定位器(URL). Web服 ...
- jquery基础研究学习【效果】
---------------------------------分割线-------------------------------------- 2017年6月7日18:16:35Query 效果 ...
- Mysql无法创建函数解决办法
执行: set global log_bin_trust_function_creators =1; 原文参照:http://www.cnblogs.com/xd502djj/archive/2012 ...