摘要: DescriptionThere are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each othe... 阅读全文
posted @ 2013-04-19 21:36 xiaxiaosheng 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionThe Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between vil... 阅读全文
posted @ 2013-04-19 21:28 xiaxiaosheng 阅读(167) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionHey, welcome to HDOJ(Hangzhou Dianzi University Online Judge).In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.InputThe input will consist of a series of integers n, one integer per line.OutputFor each case, output SUM(n) in one line, followed by a blank ... 阅读全文
posted @ 2013-04-14 16:09 xiaxiaosheng 阅读(116) 评论(0) 推荐(0) 编辑
摘要: Problem Description输入一个字符串,判断其是否是C的合法标识符。Input输入数据包含多个测试实例,数据的第一行是一个整数n,表示测试实例的个数,然后是n行输入数据,每行是一个长度不超过50的字符串。Output对于每组输入数据,输出一行。如果输入数据是C的合法标识符,则输出"yes",否则,输出“no”。Sample Input3 12ajf fi8x_a ff ai_2Sample Outputno yes noAC代码:#include<stdio.h>#include<string.h>void main(){ int n= 阅读全文
posted @ 2013-04-14 16:07 xiaxiaosheng 阅读(345) 评论(0) 推荐(0) 编辑
摘要: Problem Description输入一行数字,如果我们把这行数字中的‘5’都看成空格,那么就得到一行用空格分割的若干非负整数(可能有些整数以‘0’开头,这些头部的‘0’应该被忽略掉,除非这个整数就是由若干个‘0’组成的,这时这个整数就是0)。你的任务是:对这些分割得到的整数,依从小到大的顺序排序输出。Input输入包含多组测试用例,每组输入数据只有一行数字(数字之间没有空格),这行数字的长度不大于1000。 输入数据保证:分割得到的非负整数不会大于100000000;输入数据不可能全由‘5’组成。Output对于每个测试用例,输出分割得到的整数排序的结果,相邻的两个整数之间用一个空格分开 阅读全文
posted @ 2013-04-14 15:59 xiaxiaosheng 阅读(120) 评论(0) 推荐(0) 编辑
摘要: Problem Description求A^B的最后三位数表示的整数。 说明:A^B的含义是“A的B次方”Input输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1<=A,B<=10000),如果A=0, B=0,则表示输入数据的结束,不做处理。Output对于每个测试实例,请输出A^B的最后三位表示的整数,每个输出占一行。Sample Input2 3 12 6 6789 10000 0 0Sample Output8 984 1AC代码:#include<stdio.h> int A,B; int main() { while(scanf(&qu 阅读全文
posted @ 2013-04-14 14:55 xiaxiaosheng 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionACboy has N courses this term, and he plans to spend at most M days on study.Of course,the profit he will gain from different course depending on the days he spend on it.How to arrange the M days for the N courses to maximize the profit?InputThe input consists of multiple data set 阅读全文
posted @ 2013-04-14 14:33 xiaxiaosheng 阅读(119) 评论(0) 推荐(0) 编辑
摘要: Problem Description把一个字符三角形掏空,就能节省材料成本,减轻重量,但关键是为了追求另一种视觉效果。在设计的过程中,需要给出各种花纹的材料和大小尺寸的三角形样板,通过电脑临时做出来,以便看看效果。Input每行包含一个字符和一个整数n(0<n<41),不同的字符表示不同的花纹,整数n表示等腰三角形的高。显然其底边长为2n-1。如果遇到@字符,则表示所做出来的样板三角形已经够了。Output每个样板三角形之间应空上一行,三角形的中间为空。显然行末没有多余的空格。Sample InputX 2 A 7 @Sample OutputX XXX A A A A A A 阅读全文
posted @ 2013-04-14 14:32 xiaxiaosheng 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionGive you the width and height of the rectangle,darw it.InputInput contains a number of test cases.For each case ,there are two numbers n and m (0 < n,m < 75)indicate the width and height of the rectangle.Iuput ends of EOF.OutputFor each case,you should draw a rectangle with 阅读全文
posted @ 2013-04-14 14:30 xiaxiaosheng 阅读(160) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionThere are some students in a class, Can you help teacher find the highest student .InputThere are some cases. The first line contains an integer t, indicate the cases; Each case have an integer n ( 1 ≤ n ≤ 100 ) , followed n students’ height.OutputFor each case output the highest 阅读全文
posted @ 2013-04-14 14:28 xiaxiaosheng 阅读(139) 评论(0) 推荐(0) 编辑