摘要: Problem Description假设有x1个字母A, x2个字母B,..... x26个字母Z,同时假设字母A的价值为1,字母B的价值为2,..... 字母Z的价值为26。那么,对于给定的字母,可以找到多少价值<=50的单词呢?单词的价值就是组成一个单词的所有字母的价值之和,比如,单词ACM的价值是1+3+14=18,单词HDU的价值是8+4+21=33。(组成的单词与排列顺序无关,比如ACM与CMA认为是同一个单词)。Input输入首先是一个整数N,代表测试实例的个数。然后包括N行数据,每行包括26个<=20的整数x1,x2,.....x26.Output对于每个测试实例, 阅读全文
posted @ 2012-04-06 17:04 'wind 阅读(154) 评论(0) 推荐(0) 编辑
摘要: Problem Description2007年到来了。经过2006年一年的修炼,数学神童zouyu终于把0到100000000的Fibonacci数列(f[0]=0,f[1]=1;f[i] = f[i-1]+f[i-2](i>=2))的值全部给背了下来。接下来,CodeStar决定要考考他,于是每问他一个数字,他就要把答案说出来,不过有的数字太长了。所以规定超过4位的只要说出前4位就可以了,可是CodeStar自己又记不住。于是他决定编写一个程序来测验zouyu说的是否正确。Input输入若干数字n(0 <= n <= 100000000),每个数字一行。读到文件尾。Out 阅读全文
posted @ 2012-04-06 17:03 'wind 阅读(129) 评论(0) 推荐(0) 编辑
摘要: Problem Description妈妈你别哭泪光照亮不了我们的路让我们自己慢慢的走妈妈我会记住你和爸爸的模样记住我们的约定来生一起走上面这首诗节选自一位诗人纪念遇难同胞的作品,并没有华丽的语言,但是每位读者都应该能感受到作品传达的浓浓爱意,也许还有丝丝无奈。确实,太多的关于孩子不幸的报道冲击着我们每一颗柔弱的心。正如***总理所说“多难兴邦”,这场灾难让我们很多80后的年轻人一下子成熟了起来,其中很多人以自愿者的身份走上了抗震救灾的第一线。今天,灾区又来了n位志愿者,抗震救灾指挥部需要将他们分为若干个小组,小组的数量不限,但是要求每个小组的人数必须为素数,请问我们有几种分组的方法呢?特别说 阅读全文
posted @ 2012-04-06 17:02 'wind 阅读(260) 评论(0) 推荐(0) 编辑
摘要: Description将整数n分成k份,且每份不能为空,任意两份不能相同(不考虑顺序)。例如:n=7,k=3,下面三种分法被认为是相同的。1,1,5; 1,5,1; 5,1,1;问有多少种不同的分法。Input有多则测试数据。对于每组测试数据,仅有一行,包括两个整数n,k (6<n<=200,2<=k<=6)。Output对于每组测试数据,输出一个整数,即不同的分法。Sample Input7 3Sample Output4Hint输入: 7 3输出:4 {四种分法为:1,1,5; 1,2,4; 1,3,3; 2,2,3;}分析:此题和母函数①的不同之处在于划分数目是固 阅读全文
posted @ 2012-04-06 17:01 'wind 阅读(212) 评论(0) 推荐(0) 编辑
摘要: Problem Description开学了,杭电又迎来了好多新生。ACMer想为新生准备一个节目。来报名要表演节目的人很多,多达N个,但是只需要从这N个人中选M个就够了,一共有多少种选择方法?Input数据的第一行包括一个正整数T,接下来有T组数据,每组数据占一行。每组数据包含两个整数N(来报名的人数,1<=N<=30),M(节目需要的人数0<=M<=30)Output每组数据输出一个整数,每个输出占一行Sample Input53 25 34 43 68 0Sample Output310101方法一: 为防止溢出,可以采用乘一个除一个的方法。View Code # 阅读全文
posted @ 2012-04-06 16:58 'wind 阅读(215) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionTo improve the organization of his farm, Farmer John labels each of his N (1 <= N <= 5,000) cows with a distinct serial number in the range 1..20,000. Unfortunately, he is unaware that the cows interpret some serial numbers as better than others. In particular, a cow whose s 阅读全文
posted @ 2012-04-06 16:57 'wind 阅读(214) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionIn many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you are given a number, you have to determine the number of digits in the factorial of the number.InputInput c 阅读全文
posted @ 2012-04-06 16:56 'wind 阅读(200) 评论(0) 推荐(0) 编辑
摘要: DescriptionIn 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture:Every even number greater than 4 can bewritten as the sum of two odd prime numbers.For example:8 = 3 + 5. Both 3 and 5 are odd prime numbers.20 = 3 + 17 = 阅读全文
posted @ 2012-04-06 16:55 'wind 阅读(310) 评论(0) 推荐(0) 编辑
摘要: 要求: 输入正整数n,(2<=n<=100)把阶乘分解成素数因子相乘的形式,从小到大输出各个素数的指数。sample input:523sample output:5!=3 1 153!=49 23 12 8 4 4 3 2 2 1 1 1 1 1 1 1code:View Code #include<stdio.h>#include<string.h>//素数判定int isprime(int n){ if(i%2==0&&i!=2) return 0;for(i=2;i*i<=n;i++) if(n%i==0) return 0; 阅读全文
posted @ 2012-04-06 16:53 'wind 阅读(220) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionThe digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two or more digits, those digits are summed and the process is repeated. This is cont 阅读全文
posted @ 2012-04-06 16:51 'wind 阅读(178) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionIgnatius is poor at math,he falls across a puzzle problem,so he has no choice but to appeal to Eddy. this problem describes that:f(x)=5*x^13+13*x^5+k*a*x,input a nonegative integer k(k<10000),to find the minimal nonegative integer a,make the arbitrary integer x ,65|f(x)ifno exi 阅读全文
posted @ 2012-04-06 16:49 'wind 阅读(206) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionWe all know that Bin-Laden is a notorious terrorist, and he has disappeared for a long time. But recently, it is reported that he hides in Hang Zhou of China! “Oh, God! How terrible! ”Don’t be so afraid, guys. Although he hides in a cave of Hang Zhou, he dares not to go out. Laden 阅读全文
posted @ 2012-04-06 16:47 'wind 阅读(156) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionPeople in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e., 1-credit coins, 4-credit coins, 9-credit coins, ..., and 289-credit coins, are available in Silverland 阅读全文
posted @ 2012-04-06 16:46 'wind 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Problem Description"Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says."The second problem is, given an positive integer N, we define an equation like this:N=a[1]+a[2]+a[3]+...+a[m];a[i]>0,1<=m<=N;My question is how man 阅读全文
posted @ 2012-04-06 16:44 'wind 阅读(178) 评论(0) 推荐(0) 编辑
摘要: Problem Description1,2,...,n表示n个盘子.数字大盘子就大.n个盘子放在第1根柱子上.大盘不能放在小盘上.在第1根柱子上的盘子是a[1],a[2],...,a[n]. a[1]=n,a[2]=n-1,...,a[n]=1.即a[1]是最下面的盘子.把n个盘子移动到第3根柱子.每次只能移动1个盘子,且大盘不能放在小盘上.问第m次移动的是那一个盘子.Input每行2个整数n (1 ≤ n ≤ 63) ,m≤ 2^n-1.n=m=0退出Output输出第m次移动的盘子的号数.Sample Input63 1 63 2 0 0Sample Output1 2分析:从 移动看出 阅读全文
posted @ 2012-04-06 16:42 'wind 阅读(201) 评论(0) 推荐(0) 编辑
摘要: Problem Description据说在很久很久以前,可怜的兔子经历了人生中最大的打击——赛跑输给乌龟后,心中郁闷,发誓要报仇雪恨,于是躲进了杭州下沙某农业园卧薪尝胆潜心修炼,终于练成了绝技,能够毫不休息得以恒定的速度(VR m/s)一直跑。兔子一直想找机会好好得教训一下乌龟,以雪前耻。最近正值HDU举办50周年校庆,社会各大名流齐聚下沙,兔子也趁此机会向乌龟发起挑战。虽然乌龟深知获胜希望不大,不过迫于舆论压力,只能接受挑战。比赛是设在一条笔直的道路上,长度为L米,规则很简单,谁先到达终点谁就算获胜。无奈乌龟自从上次获胜以后,成了名龟,被一些八卦杂志称为“动物界的刘翔”,广告不断,手头也有 阅读全文
posted @ 2012-04-06 00:13 'wind 阅读(227) 评论(0) 推荐(0) 编辑