上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 19 下一页
摘要: 错排问题 把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 阅读(142) 评论(0) 推荐(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 阅读(860) 评论(0) 推荐(0) 编辑
摘要: 超级密码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 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 糖果大战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 阅读(336) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(144) 评论(0) 推荐(0) 编辑
摘要: (累了,这题做了很久!)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 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(382) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(266) 评论(0) 推荐(0) 编辑
摘要: KMP算法的next[]数组通俗解释我们在一个母字符串中查找一个子字符串有很多方法。KMP是一种最常见的改进算法,它可以在匹配过程中失配的情况下,有效地多往后面跳几个字符,加快匹配速度。当然我们可以看到这个算法针对的是子串有对称属性,如果有对称属性,那么就需要向前查找是否有可以再次匹配的内容。在KMP算法中有个数组,叫做前缀数组,也有的叫next数组,每一个子串有一个固定的next数组,它记录着字符串匹配过程中失配情况下可以向前多跳几个字符,当然它描述的也是子串的对称程度,程度越高,值越大,当然之前可能出现再匹配的机会就更大。这个next数组的求法是KMP算法的关键,但不是很好理解,我在这里用 阅读全文
posted @ 2014-03-12 22:59 ERKE 阅读(331) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 19 下一页