
floyd
取竹
Hai capito?
展开
-
[bzoj] 4720: [Noip2016]换教室
f数组表示前i个换了j次,此次是否成功的期望值。 先floyd求出所有点间的距离后,进行dp即可。 #include #include using namespace std; const int N=2005; const double eps=1e-9; int n,m,v,e,a,b; int c[N],d[N]; double ki[N],w,map[305][305],ans;原创 2017-05-17 21:30:03 · 259 阅读 · 0 评论 -
[bzoj]2306: [Ctsc2011]幸福路径
这道题用倍增+floyd。 令f[i][j][t]表示从i到j走2^t步的最大值。 就有f[i][j][t]=max{f[i][k][t-1]+f[k][j][t-1]*p^(2^t)} 在实际处理时可以省略t,每次floyd只需将p乘方即可。 #include #include using namespace std; const int N=105; int n,m,st,x,原创 2017-06-04 21:06:38 · 306 阅读 · 0 评论