题目链接:http://codeforces.com/problemset/problem/676/B

递推,dp(i, j)表示第i层第j个杯子,从第一层开始向下倒,和数塔一样的题。每个杯子1个时间能倒满,从上开始向下倒时间为t,那每个杯子不满的时候对下面的贡献一定是0,所以当dp[i][j]>=1的时候,计数倒满的杯子并且将溢出的酒向下平分。

 /*
━━━━━┒ギリギリ♂ eye!
┓┏┓┏┓┃キリキリ♂ mind!
┛┗┛┗┛┃\○/
┓┏┓┏┓┃ /
┛┗┛┗┛┃ノ)
┓┏┓┏┓┃
┛┗┛┗┛┃
┓┏┓┏┓┃
┛┗┛┗┛┃
┓┏┓┏┓┃
┛┗┛┗┛┃
┓┏┓┏┓┃
┃┃┃┃┃┃
┻┻┻┻┻┻
*/
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <climits>
#include <complex>
#include <fstream>
#include <cassert>
#include <cstdio>
#include <bitset>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <ctime>
#include <set>
#include <map>
#include <cmath>
using namespace std;
#define fr first
#define sc second
#define cl clear
#define BUG puts("here!!!")
#define W(a) while(a--)
#define pb(a) push_back(a)
#define Rint(a) scanf("%d", &a)
#define Rll(a) scanf("%I64d", &a)
#define Rs(a) scanf("%s", a)
#define Cin(a) cin >> a
#define FRead() freopen("in", "r", stdin)
#define FWrite() freopen("out", "w", stdout)
#define Rep(i, len) for(int i = 0; i < (len); i++)
#define For(i, a, len) for(int i = (a); i < (len); i++)
#define Cls(a) memset((a), 0, sizeof(a))
#define Clr(a, x) memset((a), (x), sizeof(a))
#define Fuint(a) memset((a), 0x7f7f, sizeof(a))
#define lrt rt << 1
#define rrt rt << 1 | 1
#define pi 3.14159265359
#define RT return
#define lowbit(x) x & (-x)
#define onenum(x) __builtin_popcount(x)
typedef long long LL;
typedef long double LD;
typedef unsigned long long Uint;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<int> vl;
typedef vector<vl> vvl;
typedef vector<bool> vb; const int maxn = ;
int n, t;
double dp[maxn][maxn]; int main() {
// FRead();
Rint(n); Rint(t);
int ret = ;
dp[][] = t;
For(i, , n+) {
For(j, , i+) {
if(dp[i][j] >= ) {
dp[i][j] -= ;
dp[i+][j] += (dp[i][j]) / ;
dp[i+][j+] += (dp[i][j]) / ;
ret++;
}
}
}
printf("%d\n", ret);
RT ;
}

[Codeforces676B]Pyramid of Glasses(递推,DP)的更多相关文章

  1. 递推DP URAL 1167 Bicolored Horses

    题目传送门 题意:k个马棚,n条马,黑马1, 白马0,每个马棚unhappy指数:黑马数*白马数,问最小的unhappy值是多少分析:dp[i][j] 表示第i个马棚放j只马的最小unhappy值,状 ...

  2. 递推DP URAL 1017 Staircases

    题目传送门 /* 题意:给n块砖头,问能组成多少个楼梯,楼梯至少两层,且每层至少一块砖头,层与层之间数目不能相等! 递推DP:dp[i][j] 表示总共i块砖头,最后一列的砖头数是j块的方案数 状态转 ...

  3. 递推DP URAL 1260 Nudnik Photographer

    题目传送门 /* 递推DP: dp[i] 表示放i的方案数,最后累加前n-2的数字的方案数 */ #include <cstdio> #include <algorithm> ...

  4. 递推DP URAL 1353 Milliard Vasya's Function

    题目传送门 /* 题意:1~1e9的数字里,各个位数数字相加和为s的个数 递推DP:dp[i][j] 表示i位数字,当前数字和为j的个数 状态转移方程:dp[i][j] += dp[i-1][j-k] ...

  5. 递推DP URAL 1119 Metro

    题目传送门 /* 题意:已知起点(1,1),终点(n,m):从一个点水平或垂直走到相邻的点距离+1,还有k个抄近道的对角线+sqrt (2.0): 递推DP:仿照JayYe,处理的很巧妙,学习:) 好 ...

  6. 递推DP 赛码 1005 Game

    题目传送门 /* 递推DP:官方题解 令Fi,j代表剩下i个人时,若BrotherK的位置是1,那么位置为j的人是否可能获胜 转移的时候可以枚举当前轮指定的数是什么,那么就可以计算出当前位置j的人在剩 ...

  7. 递推DP HDOJ 5328 Problem Killer

    题目传送门 /* 递推DP: 如果a, b, c是等差数列,且b, c, d是等差数列,那么a, b, c, d是等差数列,等比数列同理 判断ai-2, ai-1, ai是否是等差(比)数列,能在O( ...

  8. hdu1978(递推dp)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1978 分析: 递推DP. dp[][]表示可以到达改点的方法数. 刚开始:外循环扫描所有点dp[x][ ...

  9. 递推DP URAL 1031 Railway Tickets

    题目传送门 /* 简单递推DP:读题烦!在区间内的都更新一遍,dp[]初始化INF 注意:s1与s2大小不一定,坑! 详细解释:http://blog.csdn.net/kk303/article/d ...

  10. 递推DP UVA 607 Scheduling Lectures

    题目传送门 题意:教授给学生上课,有n个主题,每个主题有ti时间,上课有两个限制:1. 每个主题只能在一节课内讲完,不能分开在多节课:2. 必须按主题顺序讲,不能打乱.一节课L时间,如果提前下课了,按 ...

随机推荐

  1. 敏捷开发之道(二)极限编程XP

    上次的博文敏捷开发之道(一)敏捷开发宣言中,我们介绍了一下敏捷开发宣言,在其中,我们了解到了关于敏捷开发的几个重要的价值观.今天我们来了解一个敏捷开发的方法--极限编程XP 1.介绍 极限编程(eXt ...

  2. mysql存储过程中传decimal值会自动四舍五入,没有小数

    通过 call  proc(0.2,0.5);  查看结果数据库竟然是0  和 1 原因:proc的参数没有设置好 参数:原本是  in a decimal,in b decimal 应该改为:in ...

  3. 在VisualStudio 2012上使用MVC3出现错误的解决办法

    1. 错误: 找不到方法:“System.Collections.Generic.Dictionary`2<System.String,BlockParser> System.Web.Ra ...

  4. 垃圾回收 GC

    垃圾回收器的回收的对象: 垃圾回收只回收托管堆中的内存   什么样的对象才会被回收? 没有变量引用的对象.没有变量引用的对象,表示可以被回收了(null.   什么时间回收? 不确定,当程序需要新内存 ...

  5. 使用JS启动本地应用程序、屏幕键盘

    问题描述:     现在希望在Web端使用JS调用本地应用程序 问题解决:   (1)使用JS启动本地应用程序 使用上述代码重点是创建了一个ActiveXObject的对象     参考说明:     ...

  6. 关于ios中的文本操作-简介

    来源:About Text Handling in iOS 官方文档 iOS平台为我们提供了许多在app中展示文本和让用户编辑文本的方式.同时,它也允许你在app视图中展示格式化的文本和网页内容.你可 ...

  7. Unity3D与iOS的交互设计<ViewController 的跳转>

    原地址:http://www.aichengxu.com/article/%CF%B5%CD%B3%D3%C5%BB%AF/28797_12.html Unity3D与iOS的交互设计<View ...

  8. 原 Linux搭建SVN 服务器2

    原 Linux搭建SVN 服务器 发表于1年前(2014-08-05 17:55)   阅读(12257) | 评论(3) 31人收藏此文章, 我要收藏 赞3 摘要 Linux搭建SVN 服务器 目录 ...

  9. POJ1416Shredding Company

    http://poj.org/problem?id=1416 题意 : 要为碎纸机公司开发一种新的碎纸机,这种碎纸机要具有3个特性 :一是粉碎机以一个目标数 t 作为输入,并且粉碎的纸上写有一个数字n ...

  10. String及其他

    String 以下例开始讲解String public class StringDemo { public static void main(String[] args) { // String s ...