摘要: 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) 编辑
摘要: Problem Descriptionpotato老师虽然很喜欢教书,但是迫于生活压力,不得不想办法在业余时间挣点外快以养家糊口。 “做什么比较挣钱呢?筛沙子没力气,看大门又不够帅...”potato老师很是无奈。 “张艺谋比你还难看,现在多有钱呀,听说还要导演奥运开幕式呢!你为什么不去娱乐圈发展呢?”lwg在一旁出主意。 嗯,也是,为了生存,就委屈点到娱乐圈混混吧,马上就拍一部激光电影《杭电记忆——回来我的爱》。 说干就干,马上海选女主角(和老谋子学的,此举可以吸引媒体的眼球,呵呵),并且特别规定,演员必须具有ac的基本功,否则直接out! 由于策划师风之鱼(大师级水王)宣传到位,来应聘的M 阅读全文
posted @ 2013-04-14 02:15 xiaxiaosheng 阅读(194) 评论(1) 推荐(0) 编辑
摘要: Problem Description“回文串”是一个正读和反读都一样的字符串,比如“level”或者“noon”等等就是回文串。请写一个程序判断读入的字符串是否是“回文”。Input输入包含多个测试实例,输入数据的第一行是一个正整数n,表示测试实例的个数,后面紧跟着是n个字符串。Output如果一个字符串是回文串,则输出"yes",否则输出"no".Sample Input4 level abcde noon hahaSample Outputyes no yes noAC代码:#include<stdio.h>#include<st 阅读全文
posted @ 2013-04-14 02:13 xiaxiaosheng 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Problem Description作为杭电的老师,最盼望的日子就是每月的8号了,因为这一天是发工资的日子,养家糊口就靠它了,呵呵 但是对于学校财务处的工作人员来说,这一天则是很忙碌的一天,财务处的小胡老师最近就在考虑一个问题:如果每个老师的工资额都知道,最少需要准备多少张人民币,才能在给每位老师发工资的时候都不用老师找零呢? 这里假设老师的工资都是正整数,单位元,人民币一共有100元、50元、10元、5元、2元和1元六种。Input输入数据包含多个测试实例,每个测试实例的第一行是一个整数n(n<100),表示老师的人数,然后是n个老师的工资。 n=0表示输入的结束,不做处理。Outp 阅读全文
posted @ 2013-04-14 01:16 xiaxiaosheng 阅读(157) 评论(0) 推荐(0) 编辑
摘要: Problem Description作为杭电的老师,最盼望的日子就是每月的8号了,因为这一天是发工资的日子,养家糊口就靠它了,呵呵 但是对于学校财务处的工作人员来说,这一天则是很忙碌的一天,财务处的小胡老师最近就在考虑一个问题:如果每个老师的工资额都知道,最少需要准备多少张人民币,才能在给每位老师发工资的时候都不用老师找零呢? 这里假设老师的工资都是正整数,单位元,人民币一共有100元、50元、10元、5元、2元和1元六种。Input输入数据包含多个测试实例,每个测试实例的第一行是一个整数n(n<100),表示老师的人数,然后是n个老师的工资。 n=0表示输入的结束,不做处理。Outp 阅读全文
posted @ 2013-04-14 01:14 xiaxiaosheng 阅读(197) 评论(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 00:47 xiaxiaosheng 阅读(98) 评论(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 00:46 xiaxiaosheng 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionAs we know, Big Number is always troublesome. But it's really important in our ACM. And today, your task is to write a program to calculate A mod B.To make the problem easier, I promise that B will be smaller than 100000.Is it too hard? No, I work it out in 10 minutes, and my 阅读全文
posted @ 2013-04-14 00:44 xiaxiaosheng 阅读(92) 评论(0) 推荐(0) 编辑