随笔分类 -  ACM

杭电ACM
变形课
摘要:Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 11226Accepted Submission(s): 4158Problem Description呃......变形课上Harry碰到了一点小麻烦,因为他并不像Hermione那样能够记住所有的咒语而随意的将一个棒球变成刺猬什么的,但是他发现了变形咒语的一个统一规律:如果咒语是以a开头b结尾的一个单词,那么它的作用就恰好是使A物体变成B物体. Harry已经将他所会的所有咒语都列成了一个表 阅读全文
posted @ 2014-02-06 19:37 冰花ぃ雪魄 阅读(173) 评论(0) 推荐(0) 编辑
Accepted Necklace
摘要:Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2380Accepted Submission(s): 927Problem DescriptionI have N precious stones, and plan to use K of them to make a necklace for my mother, but she won't accept a necklace which is too heavy. Given th 阅读全文
posted @ 2014-02-05 20:47 冰花ぃ雪魄 阅读(253) 评论(0) 推荐(0) 编辑
连连看
摘要:Problem Description“连 连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来 (这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于我以前没有玩过连连看,咨询了同学的意见, 连线不能从外面绕过去的,但事实上这是错的。现在已经酿成大祸,就只能将错就错了,连线不能从外围绕过。玩家鼠标先后点击两块棋子,试图将他们消去,然后游戏的后台判断这两个方格能不能消去。现在你的任务就是写这个后台程序。Input输入数据有多组。每组数据的第一行有两个正整数 阅读全文
posted @ 2014-01-19 21:35 冰花ぃ雪魄 阅读(201) 评论(0) 推荐(0) 编辑
Big Event in HDU
摘要:Problem DescriptionNowadays, we all know that Computer College is the biggest department in HDU. But, maybe you don't know that Computer College had ever been split into Computer College and Software College in 2002.The splitting is absolutely a big event in HDU! At the same time, it is a troubl 阅读全文
posted @ 2014-01-19 16:24 冰花ぃ雪魄 阅读(269) 评论(0) 推荐(0) 编辑
ACM STEPS——Chapter Two——Section One
摘要:数学题小关,做得很悲剧,有几道题要查数学书。。。记下几道有价值的题吧The area(hdoj 1071)http://acm.hdu.edu.cn/showproblem.php?pid=1071直线方程易求,曲线方程要推公式。。。设y=a*x^2+b*x+c,则顶点坐标为(-b/(2a),4ac-b^2)/(4a)),又从题目中已知顶点坐标为(x1,y1),以及另一点(x2,y2),则有y2=a*x2*x2+b*x2+cy1=a*x1*x1+b*x1+cx1=-b/(2*a)所以a=(y2-y1)/((x2-x1)*(x2-x1))求出a后,剩下的b和c就没问题,而面积直接用定积分的定义搞 阅读全文
posted @ 2014-01-17 20:32 冰花ぃ雪魄 阅读(224) 评论(0) 推荐(0) 编辑
七夕节
摘要:Problem Description 七夕节那天,月老来到数字王国,他在城门上贴了一张告示,并且和数字王国的人们说:"你们想知道你们的另一半是谁吗?那就按照告示上的方法去找吧!"人们纷纷来到告示前,都想知道谁才是自己的另一半.告示如下:数字N的因子就是所有比N小又能被N整除的所有正整数,如12的因子有1,2,3,4,6.你想知道你的另一半吗? Input 输入数据的第一行是一个数字T(1#includeusing namespace std;void main(){ int n; int a; cin>>n; for(int i=0;i>a; int s 阅读全文
posted @ 2014-01-16 21:50 冰花ぃ雪魄 阅读(157) 评论(0) 推荐(0) 编辑
Cake
摘要:Problem Description一次生日Party可能有p人或者q人参加,现准备有一个大蛋糕.问最少要将蛋糕切成多少块(每块大小不一定相等),才能使p人或者q人出席的任何一种情况,都能平均将蛋糕分食. Input 每行有两个数p和q. Output 输出最少要将蛋糕切成多少块. Sample Input2 3 Sample Output4Hint将蛋糕切成大小分别为1/3,1/3,1/6,1/6的四块即满足要求. 当2个人来时,每人可以吃1/3+1/6=1/2 , 1/2块。 当3个人... 阅读全文
posted @ 2014-01-16 20:48 冰花ぃ雪魄 阅读(357) 评论(0) 推荐(0) 编辑
最大公约数与最小公倍数
摘要:求两个数的最大公约数的方法(1)用短除法求两个数的最大公约数,一般先用这两个数公有的质因数连续去除,一直除到所得的商是互质数为止,然后把所有的除数连乘起来,在除的过程中,有时也可以用两个数的公约数去除。(2)求两个数的最大公约数的两种特殊情况:①如果这两个数存在着倍数关系(即较大数是较小数的倍数),那么,较小数就是这两个数的最大公约数;②如果两个数是互质数,那么它们的最大公约数就是1。 两个数求最大公约数,可以用辗转相除法。始终用较大数除以较小数,然后用余数代替较大数。整除时的除数就是最大公约数。举例:222 407求最大公约数:222 407(407除以222余数185)222 185(.. 阅读全文
posted @ 2014-01-15 20:53 冰花ぃ雪魄 阅读(457) 评论(0) 推荐(0) 编辑
What Is Your Grade?
摘要:Problem Description “Point, point, life of student!”This is a ballad(歌谣)well known in colleges, and you must care about your score in this exam too. How many points can you get? Now, I told you the rules which are used in this course.There are 5 problems in this final exam. And I will give you 100 p 阅读全文
posted @ 2014-01-15 19:57 冰花ぃ雪魄 阅读(299) 评论(0) 推荐(0) 编辑
排列2
摘要:Problem Description Ray又对数字的列产生了兴趣:现有四张卡片,用这四张卡片能排列出很多不同的4位数,要求按从小到大的顺序输出这些4位数。 Input 每组数据占一行,代表四张卡片上的数字(0void Sort(int *a,int n){ int temp; int tem; for(int i=0;ia[j]) { temp=a[j]; tem=j; } } a[tem]=a[i]; a[i]=temp; }}void F(int a[4],int b[4],int d)//d的范围【0,4】{ int visi... 阅读全文
posted @ 2014-01-14 22:01 冰花ぃ雪魄 阅读(283) 评论(0) 推荐(0) 编辑
Tian Ji -- The Horse Racing
摘要:Problem Description Here is a famous story in Chinese history."That was about 2300 years ago. General Tian Ji was a high official in the country Qi. He likes to play horse racing with the king and others.""Both of Tian and the king have three horses in different classes, namely, regul 阅读全文
posted @ 2014-01-02 21:54 冰花ぃ雪魄 阅读(659) 评论(0) 推荐(0) 编辑
The Seven Percent Solution
摘要:Problem Description Uniform Resource Identifiers (or URIs) are strings like http://icpc.baylor.edu/icpc/, mailto:foo@bar.org, ftp://127.0.0.1/pub/linux, or even just readme.txt that are used to identify a resource, usually on the Internet or a local computer. Certain characters are reserved within U 阅读全文
posted @ 2013-12-31 22:16 冰花ぃ雪魄 阅读(335) 评论(0) 推荐(0) 编辑
hide handkerchief
摘要:Problem Description The Children’s Day has passed for some days .Has you remembered something happened at your childhood? I remembered I often played a game called hide handkerchief with my friends.Now I introduce the game to you. Suppose there are N people played the game ,who sit ... 阅读全文
posted @ 2013-12-31 14:00 冰花ぃ雪魄 阅读(819) 评论(3) 推荐(0) 编辑