题意不说了,概率和期望值要分开处理,可以先算出到达每层的概率,然后再乘以每层的期望,每层的期望是固定的。也可以从后往前直接推期望。#include #include #include #include #include using namespace std;#define N 100007doub...
分类:
其他好文 时间:
2014-07-23 20:37:35
阅读次数:
262
UVA 1476 1476 - Error Curves
题目链接
题意:给几条下凹二次函数曲线,然后问[0,1000]所有位置中,每个位置的值为曲线中最大值的值,问所有位置的最小值是多少
思路:三分法,由于都是下凹函数,所以所有曲线合并起来,仍然是一个下凹函数,满足单峰,用三分求极值
代码:
#include
#include
#include
#includ...
分类:
其他好文 时间:
2014-07-23 18:10:17
阅读次数:
256
题目链接:点击打开链接
白书的例题练练手。。。P161
#include
#include
#include
#include
#include
#include
using namespace std;
#define ll int
#define LL long long
const int mod = 1000000009;
const int maxn = 510;
con...
分类:
其他好文 时间:
2014-07-23 17:19:01
阅读次数:
268
Problem A: Tower of Cubes
In this problem you are given N colorful cubes each having a distinct weight. Each face of a cube is colored with one color. Your job is to build a tower using th...
分类:
其他好文 时间:
2014-07-23 17:07:51
阅读次数:
251
SquareInput:Standard InputOutput:Standard OutputGivennintegers you can generate2n-1non-empty subsets from them. Determine for how many of these subset...
分类:
其他好文 时间:
2014-07-23 15:17:56
阅读次数:
292
GCDInput:Standard InputOutput:Standard OutputGiven the value of N, you will have to find the value of G. The definition of G is given below:HereGCD(i,...
分类:
其他好文 时间:
2014-07-23 15:13:16
阅读次数:
246
地址:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3799
Two star-crossed lovers want to meet. The two lovers are standing at distinct points in t...
分类:
其他好文 时间:
2014-07-23 13:29:04
阅读次数:
242
题目链接:uva 279 - Spin
题目大意:进行一个游戏,给出初始状态,要求问说最少多少步可以让所有的环移动出来。移动规则如图所示。
解题思路:一开始以为是隐式图搜索,写完TLE了。后来发现这道题和汉诺塔是一个思路,都是采取最优策略,并且说左边环的状态不会影响右边环。所以dp[i]表示从右边数,第i个为v,其他均为h的步数(由全h变换至)。
模拟最优过程有dp[i]=dp[i?...
分类:
其他好文 时间:
2014-07-23 13:04:56
阅读次数:
268
DAY7一开始状态还行,最高纪录rank7,然后没力气了,一直跌到rank24,问题还是很多呐。昨天总结的问题依然很大。Problem A UVA 12377 就一开始还是慌了,没审清楚题意就去WA了一发。 大意是给你一个数字表示的字符串,最高20位,第一表示有N个质数,后面是其幂的非降序...
分类:
其他好文 时间:
2014-07-23 12:59:46
阅读次数:
376
这道题好吧,一开始便是拓扑排序的想法,搞了好久,试了多组测试数据,没错啊,可是没过。。。作孽啊,竟然忘了拓扑不能处理环,白浪费了一晚上。。。只好用动态规划了。。DP【time】【city】表示在time时刻到达city的最迟出发时间,当然,在这个时间不一定到city。转移方程挺简单,不说你也会。 1...
分类:
其他好文 时间:
2014-07-23 12:07:56
阅读次数:
298