`
hellojyj
  • 浏览: 59081 次
  • 性别: Icon_minigender_1
  • 来自: 长沙
社区版块
存档分类
最新评论
文章列表

并查集模板

 
int father[MAXM]; void init() { for(int i=0;i<MAXM;i++) father[i] = i; } int find(int a) { return father[a]==a?a:father[a] = find(father[a]); } void add(int a,int b) { int f_a = find(a); int f_b = find(b); if(f_a!=f_b) father[f_b] = f_a; }  

KMP 模板

void get_next(int* P,int* next) { int i=0,j=-1; next[0]= -1; while(i<=size_p) { if(j==-1||P[i]==P[j]) { i++;j++; next[i]=j; } else j=next[j]; } } int kmp(int* T,int* P,int* next) { int i=0,j=0; ...
原题传送门:http://acm.hdu.edu.cn/statistic.php?pid=1004   Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 73318    Accepted Submission(s): 27387 Problem Description Contest time again! How excited it is to see balloons flo ...
原题传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1874   畅通工程续 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 27465    Accepted Submission(s): 9914 Problem Description 某省自从实行了很多年的畅通 ...
原题传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1576     A/B Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1929    Accepted Submission(s): 1421 Problem Description   要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。 ...
原题传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2604   Queuing Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2538    Accepted Submission(s): 1194 Problem Description   Queues and Priority Queues are data structures which are known to m ...
原题传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1757 A Simple Math Problem Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2480    Accepted Submission(s): 1441 Problem Description   Lele now is thinking about a simple function f(x).If x &l ...
原题传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1575     Tr A Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2597    Accepted Submission(s): 1934 Problem Description   A为一个方阵,则Tr A表示A的迹(就是主对角线上各项的和),现要求Tr(A^k)%9973。     Input   数据的 ...
原题传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2036   改革春风吹满地 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18340    Accepted Submission(s): 9375 “ 改革春风吹满地,不会AC没关系;实在不行回老家,还有一亩三分地。谢谢!(乐队奏乐)”话说部分学生心态极好,每天就知道游戏,这次考试如此简单的题目,也是云里雾里,而且,还竟然来这 ...
原题传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2035     人见人爱A^B Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 21919    Accepted Submission(s): 15276 Problem Description   求A^B的最后三位数表示的整数。说明:A^B的含义是“A的B次方”     Input   输入数据包含多个测试实例 ...

HDU 2570 迷瘴

    博客分类:
  • ACM
原题传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2570   迷瘴 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3773    Accepted Submission(s): 1301 Problem Description   通过悬崖的yifenfei,又面临着幽谷 ...

HDU 4334 Trouble

    博客分类:
  • ACM
原题传送门:http://acm.hdu.edu.cn/showproblem.php?pid=4334   Trouble Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4387    Accepted Submission(s): 1302 Problem Description   Hassan is in trouble. His mathematics teacher has given him a very ...
原题传送门:http://poj.org/problem?id=1008   Maya Calendar Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 65461   Accepted: 20202 Description During his last sabbatical, professor M. A. Ya made a surprising discovery about the old Maya calendar. From an old knotted m ...
Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18924    Accepted Submission(s): 6460 Problem Description   The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following fig ...

CodeForces 229D Towers

    博客分类:
  • ACM
 
原题传送门:http://codeforces.com/problemset/problem/229/D     D. Towers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The city of D consists of n towers, built consecutively on a straight line. The height of the t ...
Global site tag (gtag.js) - Google Analytics