摘要: Description现在有x个同样的球,和y个同样的杯子,现在要把这x个球全部放到y个杯子里,请问有多少种不同放法?杯子顺序没有区分,所以1,1,2和2,1,1算作一种放法Input每组输入两个整数x,y(0 <x,y< 20)处理到文件结束Output每组测试数据用一行输出所有的种类数Sample Input7 3Sample Output8code:View Code #include<stdio.h>int d(int m,int n){ if(m==0||n==1) return 1; if(m<n) return d(m,m); else return 阅读全文
posted @ 2012-03-16 17:03 'wind 阅读(175) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionEddy是个ACMer,他不仅喜欢做ACM题,而且对于Ranklist中每个人的ac数量也有一定的研究,他在无聊时经常在纸上把Ranklist上每个人的ac题目的数量摘录下来,然后从中选择一部分人(或者全部)按照ac的数量分成两组进行比较,他想使第一组中的最小ac数大于第二组中的最大ac数,但是这样的情况会有很多,聪明的你知道这样的情况有多少种吗?特别说明:为了问题的简化,我们这里假设摘录下的人数为n人,而且每个人ac的数量不会相等,最后结果在64位整数范围内.Input输入包含多组数据,每组包含一个整数n,表示从Ranklist上摘录的总人数。Outpu 阅读全文
posted @ 2012-03-16 17:02 'wind 阅读(345) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionAunt Lizzie takes half a pill of a certain medicine every day. She starts with a bottle that contains N pills.On the first day, she removes a random pill, breaks it in two halves, takes one half and puts the other half back into the bottle.On subsequent days, she removes a random 阅读全文
posted @ 2012-03-16 17:02 'wind 阅读(280) 评论(0) 推荐(0) 编辑
摘要: Problem Description大家都知道,pfz是“成电杰出学生”,在成电杰出学生的颁奖典礼上,lxh和pfz都没有听台上在说什么,而是在下面讨论当晚的美式足球比赛,lxh预测说纽约巨人队今晚将会得到11分,pfz马上说不可能。因为通常来说美式足球比赛的得分只有3分和7分两种形式,无论怎么得分都不可能得到11分。想了一会以后,lxh发现其实11分以上的分数都是可以得到,于是11就是最大的不可以得到的分数。现在问题来了,如果比赛的得分只有x分和y分两种形式,那么最大的不可以得到的分数是多少呢?Input本题包括多组输入每组输入2个整数x, y(2<=x, y<=10^8),x 阅读全文
posted @ 2012-03-16 17:01 'wind 阅读(225) 评论(0) 推荐(0) 编辑
摘要: Problem Description在一无限大的二维平面中,我们做如下假设:1、每次只能移动一格;2、不能向后走(假设你的目的地是“向上”,那么你可以向左走,可以向右走,也可以向上走,但是不可以向下走);3、走过的格子立即塌陷无法再走第二次;求走n步不同的方案数(2种走法只要有一步不一样,即被认为是不同的方案)。Input首先给出一个正整数C,表示有C组测试数据接下来的C行,每行包含一个整数n (n<=20),表示要走n步。Output请编程输出走n步的不同方案总数;每组的输出占一行。Sample Input212Sample Output37分析: 递推式:a[i]=2*a[i-1] 阅读全文
posted @ 2012-03-16 17:00 'wind 阅读(177) 评论(0) 推荐(0) 编辑
摘要: Problem Description今年暑假杭电ACM集训队第一次组成女生队,其中有一队叫RPG,但做为集训队成员之一的野骆驼竟然不知道RPG三个人具体是谁谁。RPG给他机会让他猜猜,第一次猜:R是公主,P是草儿,G是月野兔;第二次猜:R是草儿,P是月野兔,G是公主;第三次猜:R是草儿,P是公主,G是月野兔;......可怜的野骆驼第六次终于把RPG分清楚了。由于RPG的带动,做ACM的女生越来越多,我们的野骆驼想都知道她们,可现在有N多人,他要猜的次数可就多了,为了不为难野骆驼,女生们只要求他答对一半或以上就算过关,请问有多少组答案能使他顺利过关。Input输入的数据里有多个case,每个 阅读全文
posted @ 2012-03-16 16:59 'wind 阅读(221) 评论(0) 推荐(0) 编辑
摘要: Problem Description小兔的叔叔从外面旅游回来给她带来了一个礼物,小兔高兴地跑回自己的房间,拆开一看是一个棋盘,小兔有所失望。不过没过几天发现了棋盘的好玩之处。从起点(0,0)走到终点(n,n)的最短路径数是C(2n,n),现在小兔又想如果不穿越对角线(但可接触对角线上的格点),这样的路径数有多少?小兔想了很长时间都没想出来,现在想请你帮助小兔解决这个问题,对于你来说应该不难吧!Input每次输入一个数n(1<=n<=35),当n等于-1时结束输入。Output对于每个输入数据输出路径数,具体格式看Sample。Sample Input1312-1Sample Ou 阅读全文
posted @ 2012-03-16 16:59 'wind 阅读(167) 评论(0) 推荐(0) 编辑
摘要: Problem Description由于长期缺乏运动,小黑发现自己的身材臃肿了许多,于是他想健身,更准确地说是减肥。小黑买来一块圆形的毯子,把它们分成三等分,分别标上A,B,C,称之为“跳舞毯”,他的运动方式是每次都从A开始跳,每次都可以任意跳到其他块,但最后必须跳回A,且不能原地跳.为达到减肥效果,小黑每天都会坚持跳n次,有天他突然想知道当他跳n次时共几种跳法,结果想了好几天没想出来-_-现在就请你帮帮他,算出总共有多少跳法。Input测试输入包含若干测试用例。每个测试用例占一行,表示n的值(1<=n<=1000)。当n为0时输入结束。Output每个测试用例的输出占一行,由于 阅读全文
posted @ 2012-03-16 16:58 'wind 阅读(753) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2012-03-16 16:50 'wind 阅读(7) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2012-03-16 16:08 'wind 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 要求: 桌上有一叠牌,从上到下一次编号1~n当至少剩两张牌时进行以下操作: 扔掉第一张牌,把新的第一张放到最后,输出扔掉的牌编号和剩下的牌编号sample input:7sample output:1 3 5 7 4 2 6code:View Code #include<stdio.h> const int maxn=100; int queue[maxn]; int main() { int front,rear,i,n; while(scanf("%d",&n)!=EOF) ... 阅读全文
posted @ 2012-03-16 12:51 'wind 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 要求: 输入输的深度和小球数,输出最后一个小球所在的叶子编号。code:View Code #include<stdio.h> #include<string.h> int s[1<<20]; int main() { int k,d,n,i,I; while(scanf("%d%d",&d,&I)!=EOF) { memset(s,0,sizeof(s)); n=(1<<d)-1; ... 阅读全文
posted @ 2012-03-16 12:50 'wind 阅读(221) 评论(0) 推荐(0) 编辑
摘要: DescriptionLittle Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital letters in the nodes.This is an example of one of her creations:D/ \/ \B E/ \ \/ \ \A C G//FTo record her trees for future gene... 阅读全文
posted @ 2012-03-16 12:49 'wind 阅读(175) 评论(0) 推荐(0) 编辑
摘要: DescriptionThere is a famous railway station in PopPush City. Country there is incredibly hilly. The station was built in last century. Unfortunately, funds were extremely limited that time. It was possible to establish only a surface track. Moreover, it turned out that the station could be only a d 阅读全文
posted @ 2012-03-16 12:48 'wind 阅读(218) 评论(0) 推荐(0) 编辑
摘要: Description用计算机随机生成了N个0到1000000000(包含0和1000000000)之间的随机整数(N≤5000000),对于其中重复的数字,只保留一个,把其余相同的数去掉。然后再把这些数从小到大排序。请你完成“去重”与“排序”的工作Input输入有2行,第1行为1个正整数,表示所生成的随机数的个数:N第2行有N个用空格隔开的正整数,为所产生的随机数。Output输出也是2行,第1行为1个正整数M,表示不相同的随机数的个数。第2行为M个用空格隔开的正整数,为从小到大排好序的不相同的随机数。Sample Input1020 40 32 67 40 20 89 300 400 15 阅读全文
posted @ 2012-03-16 12:47 'wind 阅读(388) 评论(0) 推荐(0) 编辑
摘要: DescriptionThere are six kinds of brackets: ‘(‘, ‘)’, ‘[‘, ‘]’, ‘{’, ‘}’. dccmx’s girl friend is now learning java programminglanguage, and got mad with brackets! Now give you a string of brackets. Is it valid? For example: “(([{}]))” is valid, but“([)]” is not.InputFirst line contains an integer T 阅读全文
posted @ 2012-03-16 12:45 'wind 阅读(204) 评论(0) 推荐(0) 编辑
摘要: DescriptionFarmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of wood, each having some integer length Li (1 ≤ Li ≤ 50,000) units. He then purchases a single long board just long enough to saw into the N 阅读全文
posted @ 2012-03-16 12:40 'wind 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Description In information theory, a low-density parity-check (LDPC) code is a linear error correcting code, a method of transmitting a message over a noisy transmission channel, and is constructed using a sparse bipartite graph. LDPC codes are capacity-approaching codes, which means that practical 阅读全文
posted @ 2012-03-16 12:39 'wind 阅读(300) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionIn this problem, we assume the positive integer with the following properties are called ‘the special number’:1) The special number is a non-negative integer without any leading zero.2) The numbers in every digit of the special number is unique ,in decimal system.Of course,it is e 阅读全文
posted @ 2012-03-16 12:36 'wind 阅读(551) 评论(0) 推荐(0) 编辑
摘要: DescriptionThe game “The Pilots Brothers: following the stripy elephant” has a quest where a player needs to open a refrigerator.There are 16 handles on the refrigerator door. Every handle can be in one of two states: open or closed. The refrigerator is open only when all handles are open. The handl 阅读全文
posted @ 2012-03-16 12:35 'wind 阅读(171) 评论(0) 推荐(0) 编辑
摘要: Description"47 is the quintessential random number," states the 47 society. And there might be a grain of truth in that.For example, the first ten digits of the Euler's constant are:2 7 1 8 2 8 1 8 2 8And what's their sum? Of course, it is 47.You are given a sequence S of integers 阅读全文
posted @ 2012-03-16 12:32 'wind 阅读(541) 评论(0) 推荐(0) 编辑
摘要: DescriptionJiaoZhu likes going on adventure! One day, he walks into a big castle, and there is an unique stairway. JiaoZhu finds a board ,it says “The one who want to go upstairs only can go three steps the most once, meaning that you can go 1 or 2 or 3 steps once!”. Now, we have a problem, can you 阅读全文
posted @ 2012-03-16 07:38 'wind 阅读(199) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionFibonacci数列,定义如下:f(1)=f(2)=1f(n)=f(n-1)+f(n-2) n>=3。计算第n项Fibonacci数值。Input输入第一行为一个整数N,接下来N行为整数Pi(1<=Pi<=1000)。Output输出为N行,每行为对应的f(Pi)。Sample Input512345Sample Output11235分析:大数加法模拟。code:View Code #include<stdio.h>#include<string.h>int i;int b[1002][255];void ji 阅读全文
posted @ 2012-03-16 07:32 'wind 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionAs we all know the Train Problem I, the boss of the Ignatius Train Station want to know if all the trains come in strict-increasing order, how many orders that all the trains can get out of the railway.InputThe input contains several test cases. Each test cases consists of a numbe 阅读全文
posted @ 2012-03-16 07:28 'wind 阅读(156) 评论(0) 推荐(0) 编辑
摘要: DescriptionOne of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums of those numbers.``This supercomputer is great,'' remarked Chip. ``I only wish Timothy were here to see these r 阅读全文
posted @ 2012-03-16 07:26 'wind 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Description 《Neon Genesis Evangelion》(中文译名:新世纪福音战士,简称EVA)。《EVA》是表面上是一部机器人动画,但是在剧情的展开手法,内容的深度上,使得一经播出就在日本引发“社会现象”程度的回应。其中涉及大量宗家和哲学的内容,复杂的人物精神分析。让《EVA》超出简单动画作品的高度。成为日本动画史上无法超越的动画之一。 “MAGI System”出自《EVA》,是作品中Nerv组织所使用的大型中央电脑系统。MAGI一词源于圣经,似乎意为东方三贤人,由东方而来朝拜耶稣的三人。该系统由三台分别以东方三贤人命名的独立电脑MELCHIOR 1、BALTHASAR 阅读全文
posted @ 2012-03-16 07:25 'wind 阅读(309) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> #include<string.h> const int maxn = 3000; int f[maxn]; int main() { int i,j,n; scanf("%d",&n); memset(f,0,sizeof(f)); f[0]=1; for(i=2;i<=n;i++) { //乘以i intc=0; for(j=0;j<m... 阅读全文
posted @ 2012-03-16 07:24 'wind 阅读(179) 评论(0) 推荐(0) 编辑
摘要: Problem Description杭州有N个景区,景区之间有一些双向的路来连接,现在8600想找一条旅游路线,这个路线从A点出发并且最后回到A点,假设经过的路线为V1,V2,....VK,V1,那么必须满足K>2,就是说至除了出发点以外至少要经过2个其他不同的景区,而且不能重复经过同一个景区。现在8600需要你帮他找一条这样的路线,并且花费越少越好。Input第一行是2个整数N和M(N <= 100, M <= 1000),代表景区的个数和道路的条数。接下来的M行里,每行包括3个整数a,b,c.代表a和b之间有一条通路,并且需要花费c元(c <= 100)。Outp 阅读全文
posted @ 2012-03-16 00:40 'wind 阅读(266) 评论(0) 推荐(0) 编辑
摘要: Problem Description虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子,^0^),很多事,还能丰富自己的阅历,还可以看美丽的风景……草儿想去很多地方,她想要去东京铁塔看夜景,去威尼斯看电影,去阳明山上看海芋,去纽约纯粹看雪景,去巴黎喝咖啡写信,去北京探望孟姜女……眼看寒假就快到了,这么一大段时间,可不能浪费啊,一定要给自己好好的放个假,可是也不能荒废了训练啊,所以草儿决定在要在最短的时间去一个自己想去的地方!因为草儿的家在一个小镇上,没有火车经过,所以她只能去邻近的城市坐火车(好可怜啊~)。I 阅读全文
posted @ 2012-03-16 00:39 'wind 阅读(150) 评论(0) 推荐(0) 编辑
摘要: Problem Description有一群人,打乒乓球比赛,两两捉对撕杀,每两个人之间最多打一场比赛。球赛的规则如下:如果A打败了B,B又打败了C,而A与C之间没有进行过比赛,那么就认定,A一定能打败C。如果A打败了B,B又打败了C,而且,C又打败了A,那么A、B、C三者都不可能成为冠军。根据这个规则,无需循环较量,或许就能确定冠军。你的任务就是面对一群比赛选手,在经过了若干场撕杀之后,确定是否已经实际上产生了冠军。Input输入含有一些选手群,每群选手都以一个整数n(n<1000)开头,后跟n对选手的比赛结果,比赛结果以一对选手名字(中间隔一空格)表示,前者战胜后者。如果n为0,则表 阅读全文
posted @ 2012-03-16 00:38 'wind 阅读(207) 评论(0) 推荐(0) 编辑