ACM
文章平均质量分 80
ACM_Ted
正在加油的火箭。
展开
-
【树形DP】Anniversary party
Anniversary partyhttp://acm.hdu.edu.cn/showproblem.php?pid=1520Problem DescriptionThere is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The Univ原创 2012-04-27 19:33:52 · 1614 阅读 · 0 评论 -
【JAVA】求和
求和Case Time Limit: 1000 ms Memory Limit: 64 MBhttp://icpc.ahu.edu.cn/OJ/Problem.aspx?id=514Judge By CaseDescription高斯在他还很小的时候就求出1+2+...+n=n*(n+1)/2;LT在他还很小的时候就求出1/(1*2)+....+1/((原创 2012-04-16 12:18:37 · 916 阅读 · 0 评论 -
【DP】FatMouse's Speed
FatMouse's SpeedTime Limit: 2 Seconds Memory Limit: 65536 KB Special Judgehttp://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=108FatMouse believes that the fatter a mous原创 2012-04-16 19:25:41 · 1270 阅读 · 0 评论 -
【DP+BFS】Robots on a grid
Robots on a gridTime Limit: 1 Sec Memory Limit: 128 MBhttp://acdreamoj.sinaapp.com/problem.php?id=1124DescriptionYou have recently made a grid traversing robot that can finnd its way from t原创 2012-04-19 00:00:25 · 716 阅读 · 0 评论 -
【STL】Squares
Squareshttp://poj.org/problem?id=2002DescriptionA square is a 4-sided polygon whose sides have equal length and adjacent sides form 90-degree angles. It is also a polygon such that rotatin原创 2012-05-20 21:58:52 · 567 阅读 · 0 评论 -
【STL】Babelfish
Babelfishhttp://poj.org/problem?id=2503DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you原创 2012-05-20 21:31:55 · 1011 阅读 · 2 评论 -
【并查集】Wireless Network
Wireless Networkhttp://poj.org/problem?id=2236DescriptionAn earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap com原创 2012-05-15 13:24:43 · 1803 阅读 · 0 评论 -
【并查集】食物链
食物链http://poj.org/problem?id=1182Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"1 X Y",表原创 2012-05-14 13:19:19 · 738 阅读 · 0 评论 -
【模拟】Another Easy Problem
Another Easy Problemhttp://acm.hdu.edu.cn/showproblem.php?pid=2418Problem DescriptionNowadays, many universities no longer force students to follow a fixed curriculum; instead they allow原创 2012-05-14 01:14:18 · 863 阅读 · 0 评论 -
【JAVA】Gary's Calculator
Gary's Calculatorhttp://acm.hdu.edu.cn/showproblem.php?pid=2424Problem DescriptionGary has finally decided to find a calculator to avoid making simple calculational mistakes in his mat原创 2012-05-13 17:42:03 · 792 阅读 · 0 评论 -
【BFS】The longest athletic track
3517. The longest athletic trackhttp://acm.tju.edu.cn/toj/showp3517.htmlAfter a long time of algorithm training, we want to hold a running contest in our beautiful campus. Because al原创 2012-05-11 00:46:56 · 874 阅读 · 0 评论 -
【模拟】我要清晰的Unicode转码表
我要清晰的Unicode转码表http://icpc.ahu.edu.cn/OJ/Problem.aspx?id=416Description据文件历史记录,WX曾经在2008年2月研究过Unicode,并尝试了Shift-JIS、GB2312、Unicode的相互转换问题。找资料当然要上官方网站,于是从unicode.org上Down下了官方编码映射表,不过看似这原创 2012-05-09 20:40:00 · 1080 阅读 · 0 评论 -
【DP】塔
塔http://icpc.ahu.edu.cn/OJ/Problem.aspx?id=518Description给出N个木块,告诉你每个木块的高度,你要用这些木块搭出两座高度相同的塔,一个塔的高度为搭建它的木块的高度之和,并且一个塔至少要用一个木块。木块只能用一次,也可以不用。问在这两座塔高度相同的条件下,能够搭出的塔的最大高度是多少?Input第原创 2012-05-08 23:58:34 · 744 阅读 · 0 评论 -
【STL】Saving the Universe
Saving the Universehttp://icpc.ahu.edu.cn/OJ/Problem.aspx?id=575DescriptionThe urban legend goes that if you go to the Google homepage and search for "Google", the universe will impl原创 2012-05-08 23:52:20 · 650 阅读 · 0 评论 -
【拓扑排序】hdu2094 产生冠军
产生冠军http://acm.hdu.edu.cn/showproblem.php?pid=2094Problem Description有一群人,打乒乓球比赛,两两捉对撕杀,每两个人之间最多打一场比赛。球赛的规则如下:如果A打败了B,B又打败了C,而A与C之间没有进行过比赛,那么就认定,A一定能打败C。如果A打败了B,B又打败了C,而且,C又打败了A,那么原创 2012-06-05 13:05:42 · 1464 阅读 · 0 评论 -
【拓扑排序】 hdu1285 确定比赛名次
确定比赛名次http://acm.hdu.edu.cn/showproblem.php?pid=1285Problem Description有N个比赛队(1 Input输入有若干组,每组中的第一行为二个数N(1 Output给出一个符合要求的排名。输出时队伍号之间有空格,最后一名后面没有空格。原创 2012-06-04 19:18:29 · 841 阅读 · 0 评论 -
【树形DP】Party at Hali-Bula
Party at Hali-Bulahttp://acm.hdu.edu.cn/showproblem.php?pid=2412Problem DescriptionDear Contestant,I'm going to have a party at my villa at Hali-Bula to celebrate my retirement from原创 2012-04-27 11:01:09 · 1314 阅读 · 0 评论 -
【DP+四边不等式优化】Division
Divisionhttp://acm.hdu.edu.cn/showproblem.php?pid=3480Problem DescriptionLittle D is really interested in the theorem of sets recently. There’s a problem that confused him a long time.原创 2012-04-24 09:52:30 · 564 阅读 · 0 评论 -
【置换群】 poj2369 Permutations
Permutations题目:http://poj.org/problem?id=2369题意:题解:置换群。求子循环节的长度,然后求其最小公倍数。代码:#include#includeusing namespace std;int ans[1005];bool visit[1005];int gcd(int x,int b){ int c; f原创 2012-08-30 01:07:35 · 1084 阅读 · 0 评论 -
【AC自动机+DP】 hdu3691 DNA repair
DNA repair题目:http://poj.org/problem?id=3691题意:就是给定N个病毒串,然后给定一个主串,然后求出修改主串多少次使得该串不包含病毒串。题解:AC自动机+DP。首先是AC自动机的空指针要修改下,不能为空,也需要指向字典树里面的结点,为了之后在字典树上DP,然后建立fail指针。dp(i,j)表示主串匹配到第i位时在自动机上的状态为j时的最少修改原创 2012-08-21 15:30:38 · 1012 阅读 · 0 评论 -
【AC自动机+DP】 hdu3689 Infinite monkey theorem
Infinite monkey theorem题目:http://acm.hdu.edu.cn/showproblem.php?pid=3689题意:字符集中有一些字符,给出每个字符的出现概率(它们的和保证为1),再给出一个子串S,问任给一个长度为N的字符串A(只能包含字符集中的字符),使得S是A的子串的概率。题解:AC自动机+DP代码:#include#include原创 2012-08-20 16:59:37 · 2353 阅读 · 0 评论 -
【数论】Non-Decreasing Digit
DescriptionA number is said to be made up of non-decreasing digits if all the digits to the left of any digit is lessthan or equal to that digit. For example, the four-digit number 1234 is compo原创 2012-04-02 18:55:03 · 1174 阅读 · 1 评论 -
【BFS】Prime Path
Prime PathTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 147 Accepted Submission(s): 94Problem DescriptionThe ministers of原创 2012-04-04 00:13:56 · 638 阅读 · 0 评论 -
【并查集+hash】Parity game
Parity gameTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4178 Accepted: 1631DescriptionNow and then you play the following game with your friend.原创 2012-04-05 09:35:26 · 978 阅读 · 0 评论 -
【DLX】Exact cover
Exact coverhttp://acm.hust.edu.cn/problem.php?id=1017DescriptionThere is an N*M matrix with only 0s and 1s, (1 Try to find out the selected rows. InputThere are multiply test cas原创 2012-04-09 11:30:01 · 901 阅读 · 1 评论 -
【并查集】Farm Irrigation
Farm IrrigationTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)http://acm.hdu.edu.cn/showproblem.php?pid=1198Problem DescriptionBenny has a spaci原创 2012-04-12 13:18:12 · 954 阅读 · 5 评论 -
【树形DP】 hdu2196 Computer
Computer题目:http://acm.hdu.edu.cn/showproblem.php?pid=2196题意:一个有N个结点的树,给你相邻两个结点的距离,问你对于第i个结点,树中离i最远的结点的距离是多少。题解:可以通过两次树形DP求解。dp[i][3],i表示为在哪里结点,0表示子树中的最长距离,1表示子树中的次长距离,2表示父树的最长距离。如果结点a本身就是父结点b最原创 2012-08-22 17:15:31 · 2258 阅读 · 0 评论 -
【数位DP】 hdu3652 B-number
B-number题目:http://acm.hdu.edu.cn/showproblem.php?pid=3652题意:问1~n中包含"13"序列且能被13整除的数有多少个。题解:详情见代码注释。代码:#include#includeusing namespace std;int dp[15][15][3];/*dp[i][j][k] j表示余数k==0 不包含原创 2012-08-22 15:17:36 · 3932 阅读 · 0 评论 -
【数位DP】 hdu3555 Bomb
Bomb题目:http://acm.hdu.edu.cn/showproblem.php?pid=3555题意:给你一个数字N(1 ,问在1~N这些数字中,“49”这个序列出现多少次。题解:数位DP。其实就是以一位数为单位的DP,有点类似AC自动机里的字典树。 我们可以根据字典树把情况分为3种,序列中出现“49”,序列中没有“49”但是最后一位是“4”,序列中没原创 2012-08-22 00:33:05 · 860 阅读 · 0 评论 -
【DLX】 hdu3957 Street Fighter
Street Fighter题目:http://acm.hdu.edu.cn/showproblem.php?pid=3957题意:模拟街头霸王游戏(我都没玩过T-T),有N(2题解:DLX的重复覆盖问题,但是要考虑一个角色有多个模式,而且每个角色只能选择一次。 1)同时使用重复覆盖和精确覆盖。 2)只用重复覆盖,同时使用一个数组记录使用原创 2012-08-20 11:03:32 · 710 阅读 · 0 评论 -
【DLX】 hdu3498 whosyourdaddy
whosyourdaddy 题目:http://acm.hdu.edu.cn/showproblem.php?pid=3498题意:英雄可以放一个技能,使得一个点和与其相邻的点受到伤害,问最少攻击几个点能够让所有的点都受到至少一次伤害。题解:建模套DLX模板。代码:#include#include#include#define N 60#define M 3600原创 2012-08-19 20:25:53 · 1004 阅读 · 0 评论 -
【树形DP】 hdu3586 Information Disturbing
Information Disturbing题目:http://acm.hdu.edu.cn/showproblem.php?pid=3586题意:给定n个敌方据点,1为司令部,其他点各有一条边相连构成一棵树,每条边都有一个权值cost表示破坏这条边的费用,叶子节点为前线。现要切断前线和司令部的联系,每次切断边的费用不能超过上限limit,问切断所有前线与司令部联系所花费的总费用少于m时的原创 2012-08-22 19:45:20 · 1176 阅读 · 0 评论 -
【hash】Conformity
ConformityTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2559 Accepted: 785DescriptionFrosh commencing their studies at Waterloo have diverse int原创 2012-04-02 22:31:39 · 715 阅读 · 0 评论 -
【BFS+hash】The Social Network
The Social NetworkTime Limit: 3000/2000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 1795 Accepted Submission(s): 555Problem DescriptionThe soci原创 2012-04-03 23:24:27 · 902 阅读 · 0 评论 -
【BFS】Knight Moves
Knight MovesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2898 Accepted Submission(s): 1822Problem DescriptionA friend of y原创 2012-04-04 21:56:44 · 616 阅读 · 0 评论 -
【并查集】小希的迷宫
小希的迷宫Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 6 Accepted Submission(s) : 5Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem原创 2012-04-05 18:41:57 · 637 阅读 · 0 评论 -
【并查集】find the most comfortable road
find the most comfortable roadTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1160 Accepted Submission(s): 466Problem Description原创 2012-04-05 20:53:04 · 630 阅读 · 0 评论 -
【STL】Is It A Tree?
Is It A Tree?Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 12 Accepted Submission(s) : 2Problem DescriptionA tree is a well-kn原创 2012-04-05 21:46:22 · 693 阅读 · 0 评论 -
【STL】Football Score
Football ScoreTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 254 Accepted Submission(s): 39Problem DescriptionFootball is原创 2012-04-08 22:48:44 · 1213 阅读 · 0 评论 -
【DP】Order Count
Order CountTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 88 Accepted Submission(s): 5Problem DescriptionIf we connect 3原创 2012-04-08 22:55:30 · 1322 阅读 · 0 评论