题目链接:uva 11291 - Smeech
题目大意:就是有一个脑残,又发明了一种机器语言,语言有两种,一种直接就是一个值,一种就是三元式(p e1 e2),有p的概率为e1+e2,1-p的概率为e1-e2.三元式的值即为期望。给定一个语句,求值。注意语句可以嵌套的。
解题思路:期望很容易求,主要是因为语句有嵌套,所以用类似语法分析的方法处理,具体看代码。
#include
#...
分类:
其他好文 时间:
2014-08-12 00:49:43
阅读次数:
296
题目链接:uva 11346 - Probability
题目大意:给定x,y的范围,以及s,问说在该范围内选取一点,和x,y轴形成图形的面积大于s的概率。
解题思路:首先达到方程xy ≥ s,即y = s / x。
S2的面积用积分计算,y = s / x的原函数为lnx
所以S2=s?(ln(a)?ln(x))
#include
#include
#inc...
分类:
其他好文 时间:
2014-08-12 00:47:53
阅读次数:
240
题目链接:uva 1541 - To Bet or Not To Bet
题目大意:在一个棋盘上进行游戏,给定棋盘长度m,不算起始和终止,以及走的步数t。从起点开始,每轮可以丢一枚硬币,正面移动2步,方面移动1步;中间的格子有写操作,包括移动一定步数,停止一次操作。问说在t步内到达终点的概率。
解题思路:dp[i][j]表示走到第i格用掉j步的概率,然后记忆化搜索,因为保证状态重复,并...
分类:
其他好文 时间:
2014-08-12 00:40:03
阅读次数:
255
题目链接:uva 11637 - Garbage Remembering Exam
题目大意:大白数里有很详细的题意。
解题思路:对于有序的序列来说,考虑每个位置为有效性的概率。C(2?kn?1?x)?A(2k2k)?A(n?1?xn?1?x)A(n?1n?1)
x为考虑当前位置,然后与该位置距离小于等于k的位置个数。该位置有效的话,则对应的要将原先邻近的2*k个单词放到另外的位置上...
分类:
其他好文 时间:
2014-08-12 00:39:53
阅读次数:
252
先上题目:F. Dancing the Cheeky-CheekyContextThe Cheeky-Cheeky is a new song. They dance it in Mula, and also in Hong Kong. All the freekies dance it, and ...
分类:
其他好文 时间:
2014-08-11 23:45:53
阅读次数:
433
Esspe-PeaseeEsspe-Peasee is an ancient game played by children throughout the land of Acmania. The rules are simple:A player simply quibs the yorba at...
分类:
其他好文 时间:
2014-08-11 23:45:23
阅读次数:
297
可能由于后台数据的原因,这道题直接暴力枚举a,b进行判断也能过,不过跑的时间长,效率太差了。
14021006
12169
Disgruntled Judge
Accepted
C++
0.876
2014-08-11 08:46:28
不说了,比较无脑。
#include
#include
#include
#incl...
分类:
其他好文 时间:
2014-08-11 21:32:12
阅读次数:
196
UVA 10228 - Star not a Tree?
题目链接
题意:给定一些点,费马点(到这些点距离和最短),输出距离和
思路:模拟退火去搞,初始温度1W步,降温系数设为0.83,然后每次找周围4个方向,做10次保证答案准确
代码:
#include
#include
#include
#include
#include
#include
using...
分类:
其他好文 时间:
2014-08-11 21:28:23
阅读次数:
415
Description
G
Weird Advertisement
Renat Mullakhanov (rem), one of the most talented programmers in the world, passed away on March 11, 2011. This is very sad news for
al...
分类:
其他好文 时间:
2014-08-11 21:27:52
阅读次数:
261
There are n SMTP servers connected by network cables. Each of the m cables connects two computers and has a certain latency measured in milliseconds required to send
an email message. What is the sh...
分类:
其他好文 时间:
2014-08-11 21:25:02
阅读次数:
384