program bzoj1023;uses math;const inf=1000000000; maxn=50005; maxm=20000005; type edge=record togo,next:longint;end; var n,m,cnt,ind,ans...
分类:
其他好文 时间:
2014-10-27 19:16:23
阅读次数:
203
const maxm=1e100; maxn=1000001; var f,x,p,c,sum,cost:array[0..maxn] of int64; q:array[0..maxn] of longint; n,i,h,t:longint; fun...
分类:
其他好文 时间:
2014-10-27 19:12:16
阅读次数:
222
program bzoj1015;{$inline on}const maxn=400001;type node=record togo,next:longint;end;var tot,n,m,d,cnt:longint; father,head,q,ans:array [0..max...
分类:
其他好文 时间:
2014-10-27 19:06:29
阅读次数:
162
program bzoj1018;type node=array [0..5] of boolean; pair=array [0..1] of boolean;var tot,c,i,j,k,x1,y1,x2,y2:longint; ans:boolean; ch:char; x,y,...
分类:
其他好文 时间:
2014-10-27 19:03:29
阅读次数:
188
program candy bzoj1062;const maxc=1000100; maxm=4010; maxn=2010;var n,len,m,i,p,t,l,r,c,d,q:longint; s:array[0..1,0..maxn,0..maxm] of lon...
分类:
其他好文 时间:
2014-10-27 19:01:21
阅读次数:
280
var f:array[0..10,0..90,0..600] of int64; a:Array[0..600] of longint; count:array[0..600] of longint; ans:int64; n,m:longint; procedure init;var...
分类:
其他好文 时间:
2014-10-27 19:00:07
阅读次数:
176
program bzoj1828;const maxn=100001; check=10000000; type node=record l,r,s,a:longint;end;var t:array [0..maxn*5] of node; a,b,c:array [0.....
分类:
其他好文 时间:
2014-10-27 18:58:21
阅读次数:
233
LCT 维护子树大小.....
2002: [Hnoi2010]Bounce 弹飞绵羊
Time Limit: 10 Sec Memory Limit: 259 MB
Submit: 4085 Solved: 2188
[Submit][Status]
Description
某天,Lostmonkey发明了一种超级弹力装置,为了在他的绵羊朋友面前显摆,他邀请小绵羊一起...
分类:
其他好文 时间:
2014-10-27 17:42:23
阅读次数:
123
题目大意:发上来就过不了审核了……总之大意就是求C(n,m) mod 10007 m,n∈[1,2*10^8]
卢卡斯定理:C(n,m)=C(n%p,m%p)*C(n/p,m/p) mod p 要求p是质数
其中n%p可能会小于m%p 这种情况下直接返回0即可
证明去问卢卡斯 我不知道
#include
#include
#include
#include
#define p 10007
...
分类:
其他好文 时间:
2014-10-27 15:41:33
阅读次数:
198
题目大意:有两个小孩在玩游戏,他们每一个人在树中取一个点,如果这两个点之间的路径长度之和是3的倍数,那么聪聪就赢了,否则他就输了。给出这棵树,求聪聪赢的概率,答案用分数表示。
思路:数据范围2w,肯定不能枚举点然后LCA。所以就只能点分治了。这还是一道比较常规的点分治问题,但是有一个地方需要注意,在统计两点之间的距离的时候我一开始的想法是直接n^2的枚举,然后记录。但是那样时间复杂度就会...
分类:
其他好文 时间:
2014-10-27 14:28:07
阅读次数:
188