明显的单调队列……但下面的程序一直有bug附上题解:http://blog.csdn.net/njlcazl/article/details/8611042附上我的代码:
1 var head,tail,i,n,maxp,w,t,ans,j:longint; 2 as,bs,ap,bp,q,...
分类:
其他好文 时间:
2014-06-09 22:58:39
阅读次数:
313
【题解】:【代码】: 1 #include 2 #include 3 #include 4
#define inf 99999999 5 using namespace std; 6 int
dp[105][10005];//i件设备,最小带宽(瓶颈)为j时的最小花费 7 int B[105]...
分类:
其他好文 时间:
2014-06-09 22:35:23
阅读次数:
259
?一、一些基本概念1、长度(真实长度):英寸、inch2、分辨率:density 每英寸像素数
dpi(密度)3、像素:px4、dip的公式:px /dip=dpi/160 所以 dip 类似于英寸、长度(dp=dip,sp类似于dip)
dip=160*inchdip= 160/dpi * px当...
分类:
移动开发 时间:
2014-06-09 22:27:31
阅读次数:
460
【题解】:【代码】: 1 #include 2 #include 3 #include 4 using
namespace std; 5 6 int dp[105][105]; 7 int N1,N2; 8 int a[105],b[105]; 9 int
main(){10 int...
分类:
其他好文 时间:
2014-06-08 23:09:50
阅读次数:
270
总算A了,心情好激动……如果会了一类斜率优化,基本上这类题就成了套模版了……只是k函数不同 1
var n,l,x,tail,head,m:int64; 2 i,j:longint; 3 dp,q,s:array[0..100000] of int64;
4 function k(x...
分类:
其他好文 时间:
2014-06-08 21:53:27
阅读次数:
247
题目
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?
For example,
Given n = 3, there are a total of 5 unique BST's.
1 3 3 2 ...
分类:
其他好文 时间:
2014-06-08 17:06:58
阅读次数:
235
题目
A message containing letters from A-Z is being encoded to numbers using
the following mapping:
'A' -> 1
'B' -> 2
...
'Z' -> 26
Given an encoded message containing digits, determine ...
分类:
其他好文 时间:
2014-06-08 15:30:08
阅读次数:
182
首先普及一个概率公式 P(A+B)=P(A)+P(B)-P(AB)
题意:一些充电元件和导线构成一棵树,充电元件是否能充电有2种情况,
1、它自己有qi%的概率充电
2、与它相邻的元件通过导线给它充电(导线有p%的概率导通)
求最终充了电的元件的期望
题解:首先可以将元件能否充电分成3种情况考虑,
1、它自己给自己充好了电
2、它的儿子方向给它传送了电
3、它的父亲方向给它传送了电...
分类:
其他好文 时间:
2014-06-08 14:43:20
阅读次数:
280
题目
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.
For example,
Given:
s1 = "aabcc",
s2 = "dbbca",
When s3 = "aadbbcbcac", return true.
When s3 = "aadb...
分类:
其他好文 时间:
2014-06-08 09:14:26
阅读次数:
215
题意:YYF从坐标1出发,每次走一步的概率是p,走两步的概率是1-p,然后有n个点上有地雷。问YYF走过雷区的概率是多少。
解法:ans[i]表示走到i的概率。概率公式ans[i]=p*ans[i-1]+(1-p)ans[i-2]
转移矩阵:
ans[i] | p ,1-p | ans[i-1]
=| |*
ans[...
分类:
其他好文 时间:
2014-06-08 03:00:48
阅读次数:
220