The Moving Points hdu4717
摘要:The Moving PointsTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 964Accepted Submission(s): 393Problem DescriptionThere are N points in total. Every point moves in certain direction and certain speed. We want to know at what time that the largest d
阅读全文
posted @
2014-03-31 23:13
ERKE
阅读(233)
推荐(0)
Naive and Silly Muggles hdu4720
摘要:Naive and Silly MugglesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 452Accepted Submission(s): 307Problem DescriptionThree wizards are doing a experiment. To avoid from bothering, a special magic is set around them. The magic forms a circle, whi
阅读全文
posted @
2014-03-31 22:24
ERKE
阅读(183)
推荐(0)
Problem 2144 Shooting Game fzu
摘要:Problem 2144 Shooting GameAccept: 99Submit: 465Time Limit: 1000 mSecMemory Limit : 32768 KBProblem DescriptionFat brother and Maze are playing a kind of special (hentai) game in the playground. (Maybe it’s the OOXX game which decrypted in the last problem, who knows.) But as they don’t like using re
阅读全文
posted @
2014-03-31 13:35
ERKE
阅读(267)
推荐(0)
数
摘要:1、本原勾股数:概念:一个三元组(a,b,c),其中a,b,c没有公因数而且满足:a^2+b^2=c^2首先,这种本原勾股数的个数是无限的,而且构造的条件满足:a=s*t,b=(s^2-t^2)/2,c=(s^2+t^2)/2其中s>t>=1是任意没有公因数的奇数!由以上概念就可以导出任意一个本原勾股数组。2、素数计数(素数定理)令π(x)为1到x中素数的个数19世纪最高的数论成就就是以下这个玩意儿:lim(x->∞){π(x)/(x/ln(x))}=1数论最高成就,最高成就!!!有木有!!!3、哥德巴赫猜想(1+1)一个大偶数(>=4)必然可以拆分为两个素数的和,虽然
阅读全文
posted @
2014-03-28 22:49
ERKE
阅读(254)
推荐(0)
数论(转载)
摘要:1.burnside定理,polya计数法 这个大家可以看brudildi的《组合数学》,那本书的这一章写的很详细也很容易理解。最好能完全看懂了,理解了再去做题,不要只记个公式。 *简单题:(直接用套公式就可以了) pku2409 Let it Bead http://acm.pku.edu.cn/JudgeOnline/problem?id=2409 pku2154 Color http://acm.pku.edu.cn/JudgeOnline/problem?id=2409 pku1286 Necklace of Beads ...
阅读全文
posted @
2014-03-28 22:32
ERKE
阅读(204)
推荐(0)
Eddy's爱好 hdu2204
摘要:Eddy's爱好Time Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1266Accepted Submission(s): 541Problem DescriptionIgnatius 喜欢收集蝴蝶标本和邮票,但是Eddy的爱好很特别,他对数字比较感兴趣,他曾经一度沉迷于素数,而现在他对于一些新的特殊数比较有兴趣。这些特殊数是这样的:这些数都能表示成M^K,M和K是正整数且K>1。正当他再度沉迷的时候,他发现不知道什么时候才能知道这样
阅读全文
posted @
2014-03-28 20:45
ERKE
阅读(169)
推荐(0)
本原串
摘要:本原串Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 580Accepted Submission(s): 202Problem Description由0和1组成的串中,不能表示为由几个相同的较小的串连接成的串,称为本原串,有多少个长为n(n 2 #include 3 #include 4 #include 5 using namespace std; 6 #define mod 2008 7 #define ll int 8 int ...
阅读全文
posted @
2014-03-25 23:12
ERKE
阅读(188)
推荐(0)
错排问题
摘要:错排问题 把n封信装进n个信封里,每封信都装错了,问一共有多少种情况? 为了方便表述,把n个信封编号为1,2,……,k,……,n。把n封信编号为f1,f2,f3,……,fk,……,fn.共有情况f(n)种。 如果n = 1,显然不可能装错,f(1) = 0; 如果n = 2,只有两种情形,一种装对,一种装错,f(2) = 1; 如果n > 2,那么考虑装错的情形,fn可以装的位置有n-1种,先假定把fn装进信封k中,则fk是否装进信封n中,分两种情况:(1)fk装进信封n中,则余下的问题是f(n-2);(2)fk不装进信封n中,这时可以假设信封k和fn消失,把fk看错fn,问题就是f(n
阅读全文
posted @
2014-03-22 19:05
ERKE
阅读(148)
推荐(0)
欧拉四面体公式
摘要:【转载】关于欧拉四面体公式的推导及证明过程1,建议x,y,z直角坐标系。设A、B、C少拿点的坐标分别为(a1,b,1,c1),(a2,b2,c2),(a3,b3,c3),四面体O-ABC的六条棱长分别为l,m,n,p,q,r;2,四面体的体积为,由于现在不知道向量怎么打出来,我就插张图片了,将这个式子平方后得到:3,根据矢量数量积的坐标表达式及数量积的定义得又根据余弦定理得4,将上述的式子带入(1),就得到了传说中的欧拉四面体公式在这里说明一点这里面的推导我也是看的,要是是我自己推出来的,我不就欧拉了,哈哈。poj有一道就是关于这个公式的,说实话出这种题很没意思,如果你不知道公式基本上就做不出
阅读全文
posted @
2014-03-20 13:49
ERKE
阅读(960)
推荐(0)
超级密码 hdu1226 bfs
摘要:超级密码Time Limit: 20000/10000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2108Accepted Submission(s): 669Problem DescriptionIgnatius花了一个星期的时间终于找到了传说中的宝藏,宝藏被放在一个房间里,房间的门用密码锁起来了,在门旁边的墙上有一些关于密码的提示信息:密码是一个C进制的数,并且只能由给定的M个数字构成,同时密码是一个给定十进制整数N(0 2 #include 3 #include 4 #i..
阅读全文
posted @
2014-03-18 23:33
ERKE
阅读(254)
推荐(0)
糖果大战 hdu1204
摘要:糖果大战Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1855Accepted Submission(s): 613Problem Description生日Party结束的那天晚上,剩下了一些糖果,Gandon想把所有的都统统拿走,Speakless于是说:“可以是可以,不过我们来玩24点,你不是已经拿到了一些糖果了吗?这样,如果谁赢一局,就拿走对方一颗糖,直到拿完对方所有的糖为止。”如果谁能算出来而对方算不出来,谁就赢,但是如果双方都能算
阅读全文
posted @
2014-03-18 09:05
ERKE
阅读(349)
推荐(0)
Find The Multiple (poj1426 一个好的做法)
摘要:Find The MultipleTime Limit:1000MSMemory Limit:10000KTotal Submissions:16505Accepted:6732Special JudgeDescriptionGiven a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than
阅读全文
posted @
2014-03-15 22:27
ERKE
阅读(150)
推荐(0)
Life Forms (poj3294 后缀数组求 不小于k个字符串中的最长子串)
摘要:(累了,这题做了很久!)Life FormsTime Limit:5000MSMemory Limit:65536KTotal Submissions:8683Accepted:2375DescriptionYou may have wondered why most extraterrestrial life forms resemble humans, differing by superficial traits such as height, colour, wrinkles, ears, eyebrows and the like. A few bear no human resem
阅读全文
posted @
2014-03-13 22:29
ERKE
阅读(231)
推荐(0)
Long Long Message (poj2774 后缀数组求最长公共子串)
摘要:Long Long MessageTime Limit:4000MSMemory Limit:131072KTotal Submissions:19206Accepted:7934Case Time Limit:1000MSDescriptionThe little cat is majoring in physics in the capital of Byterland. A piece of sad news comes to him these days: his mother is getting ill. Being worried about spending so much o
阅读全文
posted @
2014-03-13 14:16
ERKE
阅读(395)
推荐(0)
687. Repeats spoj (后缀数组 重复次数最多的连续重复子串)
摘要:687. RepeatsProblem code: REPEATSA string s is called an (k,l)-repeat if s is obtained by concatenating k>=1 times some seed string t with length l>=1. For example, the strings = abaabaabaabais a (4,3)-repeat with t = aba as its seed string. That is, the seed string t is 3 characters long, and
阅读全文
posted @
2014-03-13 13:37
ERKE
阅读(263)
推荐(0)
Maximum repetition substring (poj3693 后缀数组求重复次数最多的连续重复子串)
摘要:Maximum repetition substringTime Limit:1000MSMemory Limit:65536KTotal Submissions:6328Accepted:1912DescriptionThe repetition number of a string is defined as the maximum numberRsuch that the string can be partitioned intoRsame consecutive substrings. For example, the repetition number of "ababa
阅读全文
posted @
2014-03-13 13:21
ERKE
阅读(283)
推荐(0)
kmp next数组的理解(挺好的一篇文章 ,原来kmp最初的next是这样的啊,很好理解)
摘要:KMP算法的next[]数组通俗解释我们在一个母字符串中查找一个子字符串有很多方法。KMP是一种最常见的改进算法,它可以在匹配过程中失配的情况下,有效地多往后面跳几个字符,加快匹配速度。当然我们可以看到这个算法针对的是子串有对称属性,如果有对称属性,那么就需要向前查找是否有可以再次匹配的内容。在KMP算法中有个数组,叫做前缀数组,也有的叫next数组,每一个子串有一个固定的next数组,它记录着字符串匹配过程中失配情况下可以向前多跳几个字符,当然它描述的也是子串的对称程度,程度越高,值越大,当然之前可能出现再匹配的机会就更大。这个next数组的求法是KMP算法的关键,但不是很好理解,我在这里用
阅读全文
posted @
2014-03-12 22:59
ERKE
阅读(346)
推荐(0)
Power Strings poj2406(神代码)
摘要:Power StringsTime Limit:3000MSMemory Limit:65536KTotal Submissions:29402Accepted:12296DescriptionGiven two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplicatio
阅读全文
posted @
2014-03-12 22:01
ERKE
阅读(199)
推荐(0)
Palindrome poj3974
摘要:PalindromeTime Limit:15000MSMemory Limit:65536KTotal Submissions:3280Accepted:1188DescriptionAndy the smart computer science student was attending an algorithms class when the professor asked the students a simple question, "Can you propose an efficient algorithm to find the length of the large
阅读全文
posted @
2014-03-12 21:10
ERKE
阅读(203)
推荐(0)
Manacher’s Algorithm (神啊)
摘要:(转载自)http://blog.csdn.net/hopeztm/article/details/7932245这里描述了一个叫Manacher’sAlgorithm的算法。算法首先将输入字符串S, 转换成一个特殊字符串T,转换的原则就是将S的开头结尾以及每两个相邻的字符之间加入一个特殊的字符,例如#例如: S = “abaaba”, T = “#a#b#a#a#b#a#”.为了找到最长的回文字串,例如我们当前考虑以Ti为回文串中间的元素,如果要找到最长回文字串,我们要从当前的Ti扩展使得Ti-d… Ti+d组成最长回文字串. 这里d其实和 以Ti为中心的回文串长度是一样的. 进一步解释就是
阅读全文
posted @
2014-03-12 21:09
ERKE
阅读(625)
推荐(0)
最长回文 hdu3068(神代码)
摘要:最长回文Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6629Accepted Submission(s): 2284Problem Description给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度.回文就是正反读都是一样的字符串,如aba, abba等Input输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c...y,z组成的字符串S两组case之间由空行隔开(该空行不用处理
阅读全文
posted @
2014-03-12 20:23
ERKE
阅读(404)
推荐(0)
1297. Palindrome ural1297(后缀数组)
摘要:1297. PalindromeTime limit: 1.0 secondMemory limit: 64 MBThe “U.S. Robots” HQ has just received a rather alarming anonymous letter. It states that the agent from the competing «Robots Unlimited» has infiltrated into “U.S. Robotics”. «U.S. Robots» security service would have alrea
阅读全文
posted @
2014-03-12 16:30
ERKE
阅读(246)
推荐(0)
705. New Distinct Substrings spoj(后缀数组求所有不同子串)
摘要:705. New Distinct SubstringsProblem code: SUBST1Given a string, we need to find the total number of its distinct substrings.InputT- number of test cases. T 2 #include 3 #include 4 using namespace std; 5 #define N 51000 6 char a[N]; 7 int c[N],d[N],e[N],sa[N],height[N],n,b[N],m; 8 int cmp(int *r,in..
阅读全文
posted @
2014-03-11 23:55
ERKE
阅读(248)
推荐(0)
Milk Patterns poj3261(后缀数组)
摘要:Milk PatternsTime Limit:5000MSMemory Limit:65536KTotal Submissions:9274Accepted:4173Case Time Limit:2000MSDescriptionFarmer John has noticed that the quality of milk given by his cows varies from day to day. On further investigation, he discovered that although he can't predict the quality of mi
阅读全文
posted @
2014-03-11 13:57
ERKE
阅读(234)
推荐(0)
Musical Theme poj1743(后缀数组)
摘要:Musical ThemeTime Limit:1000MSMemory Limit:30000KTotal Submissions:16757Accepted:5739DescriptionA musical melody is represented as a sequence of N (1 2 #include 3 #include 4 using namespace std; 5 #define N 20001 6 int a[N],c[N],d[N],e[N],sa[N],height[N],n,b[N],m; 7 int cmp(int *r,int a,int b,int ..
阅读全文
posted @
2014-03-11 13:50
ERKE
阅读(228)
推荐(0)
Conscription poj3723(最大生成树)
摘要:ConscriptionTime Limit:1000MSMemory Limit:65536KTotal Submissions:6870Accepted:2361DescriptionWindy has a country, and he wants to build an army to protect his country. He has picked upNgirls andMboys and wants to collect them to be his soldiers. To collect a soldier without any privilege, he must p
阅读全文
posted @
2014-03-09 09:47
ERKE
阅读(609)
推荐(0)
Drying poj3104(二分)
摘要:DryingTime Limit:2000MSMemory Limit:65536KTotal Submissions:7916Accepted:2006DescriptionIt is very hard to wash and especially to dry clothes in winter. But Jane is a very smart girl. She is not afraid of this boring process. Jane has decided to use a radiator to make drying faster. But the radiator
阅读全文
posted @
2014-03-08 22:43
ERKE
阅读(158)
推荐(0)
Finding LCM (最小公倍数)
摘要:Finding LCMTime Limit:2000MSMemory Limit:32768KB64bit IO Format:%lld & %llu[Submit] [Go Back] [Status]DescriptionLCMis an abbreviation used forLeastCommonMultiple in Mathematics. We sayLCM (a, b, c) = Lif and only ifLis the least integer which is divisible bya, bandc.You will be givena, bandL. Y
阅读全文
posted @
2014-03-08 21:24
ERKE
阅读(351)
推荐(0)
Dice (II) (DP)唉,当时没做出来
摘要:Dice (II)Time Limit:3000MSMemory Limit:32768KB64bit IO Format:%lld & %llu[Submit] [Go Back] [Status]DescriptionYou haveNdices; each of them hasKfaces numbered from1toK. Now you can arrange theNdices in a line. If the summation of the top faces of the dices isS, you calculate the score as the mul
阅读全文
posted @
2014-03-08 21:05
ERKE
阅读(310)
推荐(0)
D. Mysterious Present (看到的一个神奇的DP,也可以说是dfs)
摘要:D. Mysterious Presenttime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputPeter decided to wish happy birthday to his friend from Australia and send him a card. To make his present more mysterious, he decided to make achain. Chain here is such a sequen
阅读全文
posted @
2014-03-07 20:52
ERKE
阅读(308)
推荐(0)
E. Fish (概率DP)
摘要:E. Fishtime limit per test3 secondsmemory limit per test128 megabytesinputstandard inputoutputstandard outputnfish, numbered from1ton, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first w
阅读全文
posted @
2014-03-07 13:11
ERKE
阅读(251)
推荐(0)
郑厂长系列故事——排兵布阵 hdu4539(状态压缩DP)
摘要:郑厂长系列故事——排兵布阵Time Limit: 10000/5000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 1509Accepted Submission(s): 554Problem Description 郑厂长不是正厂长 也不是副厂长 他根本就不是厂长 事实上 他是带兵打仗的团长 一天,郑厂长带着他的军队来到了一个n*m的平原准备布阵。 根据以往的战斗经验,每个士兵可以攻击到并且只能攻击到与之曼哈顿距离为2的位置以及士兵本身所在的位置。当然,一个士兵不能站...
阅读全文
posted @
2014-03-06 22:20
ERKE
阅读(288)
推荐(0)
Corn Fields poj3254(状态压缩DP)
摘要:Corn FieldsTime Limit:2000MSMemory Limit:65536KTotal Submissions:6081Accepted:3226DescriptionFarmer John has purchased a lush new rectangular pasture composed ofMbyN(1 ≤M≤ 12; 1 ≤N≤ 12) square parcels. He wants to grow some yummy corn for the cows on a number of squares. Regrettably, some of the squ
阅读全文
posted @
2014-03-06 19:28
ERKE
阅读(222)
推荐(0)
Suneast & Daxia (规律)
摘要:Suneast & DaxiaTime Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64u[Submit] [Go Back] [Status]DescriptionDaxia is so cute that people loves it so much.Everyone wants to buy Daxia from Suneast (a business man who sells Daxia).Suneast is a strange business man. He sells Daxia in
阅读全文
posted @
2014-03-05 13:20
ERKE
阅读(247)
推荐(0)
C - Coin Change (III)(多重背包 二进制优化)
摘要:C -Coin Change (III)Time Limit:2000MSMemory Limit:32768KB64bit IO Format:%lld & %lluSubmitStatusPracticeLightOJ 1233DescriptionIn a strange shop there arentypes of coins of valueA1, A2... An.C1, C2, ... Cndenote the number of coins of valueA1, A2... Anrespectively. You have to find the number of
阅读全文
posted @
2014-03-05 13:16
ERKE
阅读(205)
推荐(0)
Coin Change (IV) (dfs)
摘要:Coin Change (IV)Time Limit:1000MSMemory Limit:32768KB64bit IO Format:%lld & %llu[Submit] [Go Back] [Status]DescriptionGivenncoins, values of them areA1, A2... Anrespectively, you have to find whether you can payKusing the coins. You can use any coin at most two times.InputInput starts with an in
阅读全文
posted @
2014-03-05 13:16
ERKE
阅读(270)
推荐(0)
Coin Change (II)(完全背包)
摘要:Coin Change (II)Time Limit:1000MSMemory Limit:32768KB64bit IO Format:%lld & %llu[Submit] [Go Back] [Status]DescriptionIn a strange shop there arentypes of coins of valueA1, A2... An. You have to find the number of ways you can makeKusing the coins. You can use any coin a...
阅读全文
posted @
2014-03-05 13:12
ERKE
阅读(297)
推荐(0)
Problem 2062 Suneast & Yayamao 二进制(多重背包的理解基础)
摘要:Problem 2062 Suneast & YayamaoAccept: 143Submit: 313Time Limit: 1000 mSecMemory Limit : 32768 KBProblem DescriptionYayamao is so cute that people loves it so much.Everyone wants to buy Yayamao from Suneast (a business man who sells Yayamao).Suneast is a strange business man. He se...
阅读全文
posted @
2014-03-04 13:02
ERKE
阅读(266)
推荐(0)
The Twin Towers zoj2059 DP
摘要:The Twin TowersTime Limit:2 Seconds Memory Limit:65536 KBTwin towers we see you standing tall, though a building's lost our faith will never fall.Twin towers the world hears your call, though you're gone it only strengthens our resolve.We couldn't make it through this without you Lord, t
阅读全文
posted @
2014-03-03 19:01
ERKE
阅读(304)
推荐(0)
1523. K-inversions URAL 求k逆序对,,,,DP加树状数组
摘要:1523. K-inversionsTime limit: 1.0 secondMemory limit: 64 MBConsider a permutationa1,a2, …,an(allaiare different integers in range from 1 ton). Let us callk-inversiona sequence of numbersi1,i2, …,iksuch that 1≤i1ai2>…>aik. Your task is to evaluate the number of differentk-inversions in a given
阅读全文
posted @
2014-03-03 13:20
ERKE
阅读(343)
推荐(0)
Football 概率DP poj3071
摘要:FootballTime Limit:1000MSMemory Limit:65536KTotal Submissions:2590Accepted:1315DescriptionConsider a single-elimination football tournament involving 2nteams, denoted 1, 2, …, 2n. In each round of the tournament, all teams still in the tournament are pla...
阅读全文
posted @
2014-03-02 10:17
ERKE
阅读(187)
推荐(0)
Collecting Bugs poj2096 概率DP
摘要:Collecting BugsTime Limit:10000MSMemory Limit:64000KTotal Submissions:1899Accepted:901Case Time Limit:2000MSSpecial JudgeDescriptionIvan is fond of collecting. Unlike other people who collect post stamps, coins or other material stuff, he collects software bugs. When Iv...
阅读全文
posted @
2014-03-02 00:25
ERKE
阅读(172)
推荐(0)
E. Exposition
摘要:E. Expositiontime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputThere are several days left before the fiftieth birthday of a famous Berland's writer Berlbury. In this connection the local library decided to make an ...
阅读全文
posted @
2014-03-01 21:35
ERKE
阅读(443)
推荐(0)