摘要:
【转】欧拉函数 对正整数n,欧拉函数是少于或等于n的数中与n互质的数的数目。例如euler(8)=4,因为1,3,5,7均和8互质。 Euler函数表达通式:euler(x)=x(1-1/p1)(1-1/p2)(1-1/p3)(1-1/p4)…(1-1/pn),其中p1,p2……pn为x的所有素因数...
阅读全文
posted @ 2015-06-01 21:05
__560
阅读(271)
推荐(0)
摘要:
Dream_Chaser队训练赛第一场 K题题目来自2012成都区域赛K -Yet Another Multiple ProblemTime Limit:20000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uSubmitStatusPract...
阅读全文
posted @ 2015-06-01 00:40
__560
阅读(215)
推荐(0)
摘要:
Dream_Chaser队训练赛第一场 I题题目来自2012成都区域赛I -CountTime Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uSubmitStatusPracticeHDU 4472DescriptionPr...
阅读全文
posted @ 2015-06-01 00:30
__560
阅读(262)
推荐(0)
摘要:
从寒假开刷poj以来,刷的题数也不少了,但水平还是没多大提高。现在发现这半年来刷的大多是水题,题目思维量不大,都是基础中的基础,虽然学了一些很基础的算法和数据结构,但还有很多很基础的算法和数据结构还没学,比如kmp,线段树,数位dp,数论四大定理等等,同时像cf上一些具备一定思维量的题目做得比较...
阅读全文
posted @ 2015-05-29 20:56
__560
阅读(258)
推荐(0)
摘要:
西电oj1066 费马小定理问题 A: A^B % P时间限制:1 Sec内存限制:128 MB提交:28解决:8[提交][状态][讨论版]题目描述输入输出样例输入23 1 22 2 2样例输出964思路:先求k=B0*B1*...*Bn-1%(p-1),最后算出A^k%p即为答案。 依据:由...
阅读全文
posted @ 2015-05-29 18:02
__560
阅读(271)
推荐(0)
摘要:
早晨训练赛第一场 B题B -Trees in a RowTime Limit:1000MSMemory Limit:262144KB64bit IO Format:%I64d & %I64uSubmitStatusPracticeCodeForces 402BDescriptionThe Queen...
阅读全文
posted @ 2015-05-25 20:22
__560
阅读(224)
推荐(0)
摘要:
早晨训练赛第一场 C题C -Searching for GraphTime Limit:1000MSMemory Limit:262144KB64bit IO Format:%I64d & %I64uSubmitStatusPracticeCodeForces 402CDescriptionLet'...
阅读全文
posted @ 2015-05-25 11:07
__560
阅读(215)
推荐(0)
摘要:
早晨训练赛第一场 A题A -NutsTime Limit:1000MSMemory Limit:262144KB64bit IO Format:%I64d & %I64uSubmitStatusPracticeCodeForces 402ADescriptionYou haveanuts and l...
阅读全文
posted @ 2015-05-25 10:41
__560
阅读(283)
推荐(0)
摘要:
codeforces#303div2_D 贪心D. Queuetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle girl Susie ...
阅读全文
posted @ 2015-05-21 01:58
__560
阅读(226)
推荐(0)
摘要:
codeforces#303div2_C 贪心C. Woodcutterstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle Susie...
阅读全文
posted @ 2015-05-21 01:40
__560
阅读(221)
推荐(0)
摘要:
西电oj 1038 状压dp1038: 裁玻璃时间限制:1 Sec内存限制:128 MB提交:33解决:4[提交][状态][讨论版]题目描述张老板的玻璃店开张了,生意火爆。今天,隔壁玻璃店的刘老板拿来一块玻璃,意在刁难张老板。刘老板说:“我这块玻璃是由N(行)*M(列)小正方形玻璃拼成的,但是其中有...
阅读全文
posted @ 2015-05-15 19:06
__560
阅读(670)
推荐(0)
摘要:
poj1185 状压dp炮兵阵地Time Limit:2000MSMemory Limit:65536KTotal Submissions:20940Accepted:8104Description司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一...
阅读全文
posted @ 2015-05-15 00:39
__560
阅读(271)
推荐(0)
摘要:
codeforces#302div2_C dp,二维完全背包C. Writing Codetime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPro...
阅读全文
posted @ 2015-05-14 01:21
__560
阅读(438)
推荐(0)
摘要:
西电oj1037 字符串1037: 倍流畅序列时间限制:1 Sec内存限制:128 MB提交:34解决:9[提交][状态][讨论版]题目描述对于一个0、1串s, 从左端开始读取它的0获得序列s0,从右端开始读取它的1获得s1,如果s1与s2同构,则称s为倍流畅序列.例如:011001是一个倍流畅序列...
阅读全文
posted @ 2015-05-13 16:24
__560
阅读(318)
推荐(0)
摘要:
西电oj 1036 dp(01背包)1036: 分配宝藏时间限制:1 Sec内存限制:128 MB提交:40解决:11[提交][状态][讨论版]题目描述两个寻宝者找到一个宝藏,里面包含着n件物品,每件物品的价值是w[i]。suma代表寻宝者A所获物品的总价值,sumb代表寻宝者B所获物品的总价值,...
阅读全文
posted @ 2015-05-13 11:55
__560
阅读(798)
推荐(0)
摘要:
codeforces#302div2_D 暴力bfs求最短路,图论D. Destroying Roadstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard ou...
阅读全文
posted @ 2015-05-12 22:22
__560
阅读(303)
推荐(0)
摘要:
lucas定理计算组合数C(n,k)有多种解法,1,dp递推;2,直接计算;3,lucas定理lucas定理适合组合数取余数的计算,n和k的范围可到10^18注意p必须为素数如果p(mod)较小还可以预处理1到p的阶乘,下面是用乘法逆元计算C(n%p,k%p),关于乘法逆元,参考这篇博客:http:...
阅读全文
posted @ 2015-05-06 09:33
__560
阅读(520)
推荐(0)
摘要:
西电校赛网络赛J题 lucas定理计算组合数问题 J: 找规律II时间限制:1 Sec内存限制:128 MB 提交:96解决:16 [提交][状态][讨论版]题目描述现有数阵如下:1 2 3 4 5 6 1 3 6 10 15 1 4 10 20 1 ...
阅读全文
posted @ 2015-05-06 09:30
__560
阅读(302)
推荐(0)
摘要:
bestcoder#37_1001 字符串,dfsRikka with string Accepts: 395 Submissions: 2281 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/...
阅读全文
posted @ 2015-04-11 23:15
__560
阅读(241)
推荐(0)
摘要:
codeforces#297div2_d bfs,2*2法判断矩阵里的矩形D. Arthur and Wallstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandar...
阅读全文
posted @ 2015-04-11 15:17
__560
阅读(277)
推荐(0)
摘要:
codeforces#297div2_c 贪心C. Ilya and Stickstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn the ...
阅读全文
posted @ 2015-04-11 12:04
__560
阅读(261)
推荐(0)
摘要:
codeforces#297div2_b 贪心,字符串Pasha got a very beautiful stringsfor his birthday, the string consists of lowercase Latin letters. The letters in the stri...
阅读全文
posted @ 2015-04-11 11:31
__560
阅读(244)
推荐(0)
摘要:
poj2983——差分约束,bellman_fordIs the Information Reliable?Time Limit:3000MSMemory Limit:131072KTotal Submissions:11560Accepted:3658DescriptionThe galaxy w...
阅读全文
posted @ 2015-04-09 23:56
__560
阅读(264)
推荐(0)
摘要:
poj1201——差分约束,spfaIntervalsTime Limit:2000MSMemory Limit:65536KTotal Submissions:22553Accepted:8530DescriptionYou are given n closed, integer interval...
阅读全文
posted @ 2015-04-09 21:55
__560
阅读(399)
推荐(0)
摘要:
图的邻接表存储struct Edge{ int v; ll w; Edge *next;};Edge e[maxn*10];void add_edge(int u,int v,ll w) ///插入邻接表的首部而非尾部,避免遍历{ Edge *pre=&e[u]; Ed...
阅读全文
posted @ 2015-04-09 17:42
__560
阅读(187)
推荐(0)
摘要:
hiho1093 ——spfa时间限制:10000ms单点时限:1000ms内存限制:256MB描述万圣节的晚上,小Hi和小Ho在吃过晚饭之后,来到了一个巨大的鬼屋!鬼屋中一共有N个地点,分别编号为1..N,这N个地点之间互相有一些道路连通,两个地点之间可能有多条道路连通,但是并不存在一条两端都是同...
阅读全文
posted @ 2015-04-09 17:37
__560
阅读(278)
推荐(0)
摘要:
poj1716——差分约束Integer IntervalsTime Limit:1000MSMemory Limit:10000KTotal Submissions:13029Accepted:5516DescriptionAn integer interval [a,b], a =2,0=2,s...
阅读全文
posted @ 2015-04-09 14:58
__560
阅读(256)
推荐(0)
摘要:
poj1113——凸包WallTime Limit:1000MSMemory Limit:10000KTotal Submissions:31132Accepted:10497DescriptionOnce upon a time there was a greedy King who ordere...
阅读全文
posted @ 2015-04-07 19:43
__560
阅读(244)
推荐(0)
摘要:
求凸包—— graham_scan算法先按Y-X排序,在按对p0的极角排序,然后进行扫瞄bool cmp(Point A,Point B){ //return (A-vert[0])*(B-vert[0])>EPS; double tmp=(A-vert[0])*(B-vert[0]);...
阅读全文
posted @ 2015-04-06 23:18
__560
阅读(331)
推荐(0)
摘要:
poj2187 求平面最远点对,garham_scan算法求凸包Beauty ContestTime Limit:3000MSMemory Limit:65536KTotal Submissions:29666Accepted:9180DescriptionBessie, Farmer John's...
阅读全文
posted @ 2015-04-06 23:09
__560
阅读(278)
推荐(0)
摘要:
bestcoder#36 1002 哈希GunnerTime Limit: 8000/4000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 726Accepted Submission(s...
阅读全文
posted @ 2015-04-05 17:29
__560
阅读(235)
推荐(0)
摘要:
poj1584——判断凸包,判断点是否在多边形内A Round Peg in a Ground HoleTime Limit:1000MSMemory Limit:10000KTotal Submissions:5441Accepted:1729DescriptionThe DIY Furnitur...
阅读全文
posted @ 2015-04-03 13:25
__560
阅读(405)
推荐(0)
摘要:
poj1408——叉积求多边形面积FishnetTime Limit:1000MSMemory Limit:10000KTotal Submissions:1853Accepted:1185DescriptionA fisherman named Etadokah awoke in a very s...
阅读全文
posted @ 2015-04-02 22:44
__560
阅读(226)
推荐(0)
摘要:
重载Point其中减法表示向量,乘法表示叉积struct Point{ double x,y; friend double operator*(const Point A,const Point B) { return A.x*B.y-A.y*B.x; } ...
阅读全文
posted @ 2015-04-02 18:25
__560
阅读(210)
推荐(0)
摘要:
求直线与线段的交点求交点定比分点法,用叉积求面积,用面积比代替线段长度比Point inter_point(Point A,Point B,Point C,Point D)///返回直线AB和线段CD的交点{ if(!intersect(A,B,C,D)) return {-INF*1.0,0...
阅读全文
posted @ 2015-04-02 18:23
__560
阅读(234)
推荐(0)
摘要:
poj1039——计算几何 求直线与线段交点,判断两条直线是否相交PipeTime Limit:1000MSMemory Limit:10000KTotal Submissions:9439Accepted:2854DescriptionThe GX Light Pipeline Company s...
阅读全文
posted @ 2015-04-02 18:05
__560
阅读(815)
推荐(0)
摘要:
poj——2031 最小生成树(MST) Kruskal算法Building a Space StationTime Limit:1000MSMemory Limit:30000KTotal Submissions:4985Accepted:2503DescriptionYou are a memb...
阅读全文
posted @ 2015-03-31 21:01
__560
阅读(383)
推荐(0)
摘要:
poj3122——二分查找PieTime Limit:1000MSMemory Limit:65536KTotal Submissions:11698Accepted:4050Special JudgeDescriptionMy birthday is coming up and tradition...
阅读全文
posted @ 2015-03-31 14:42
__560
阅读(265)
推荐(0)
摘要:
poj1905——二分法求单调函数零点解方程Expanding RodsTime Limit:1000MSMemory Limit:30000KTotal Submissions:12773Accepted:3291DescriptionWhen a thin rod of length L is ...
阅读全文
posted @ 2015-03-31 13:17
__560
阅读(622)
推荐(0)
摘要:
poj3258——二分优化River HopscotchTime Limit:2000MSMemory Limit:65536KTotal Submissions:8201Accepted:3531DescriptionEvery year the cows hold an event featur...
阅读全文
posted @ 2015-03-30 17:27
__560
阅读(254)
推荐(0)