ACM试题
文章平均质量分 77
处变不惊
这个作者很懒,什么都没留下…
展开
-
素数环
#includeint n,isp[200],a[100],vis[100]={0};int fun(int n){ int i; for (i=2;i<=n/2;i++) if (n%i==0) return 0; return 1;}void dfs(int cur){ int i; if (cur==n&&isp[a[0]+a[cur-1]]) {原创 2015-11-01 23:58:54 · 286 阅读 · 0 评论 -
HDU Dancing Stars on Me
Dancing Stars on MeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 17 Accepted Submission(s): 14Problem DescriptionThe sky was brushe原创 2015-11-01 17:41:47 · 276 阅读 · 0 评论 -
HDU 1789 Doing Homework again
Doing Homework againTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9936 Accepted Submission(s): 5803Problem DescriptionIgnatius has ju原创 2016-01-16 14:26:49 · 257 阅读 · 0 评论 -
HDU 2709 Sumsets
SumsetsTime Limit: 6000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2022 Accepted Submission(s): 797Problem DescriptionFarmer John commanded his cow原创 2016-01-16 20:16:08 · 97 阅读 · 0 评论 -
蓝桥杯 剪格子
#includeint dir[4][2]={0,1,0,-1,-1,0,1,0};int vis[12][12],map[12][12];int m,n,sum;int check(int x,int y,int ans){ if (xn||y>m) return 0; if (vis[x][y]) return 0; if (ans>sum/2原创 2016-01-18 16:45:08 · 243 阅读 · 0 评论 -
HDU 2073 无限的路
无限的路Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7313 Accepted Submission(s): 3753Problem Description甜甜从小就喜欢画图画,最近他买了一支智能画笔,由于刚刚接触,所原创 2016-01-14 19:49:34 · 275 阅读 · 0 评论 -
HDU 2076 夹角有多大(题目已修改,注意读题)
夹角有多大(题目已修改,注意读题)Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 12478 Accepted Submission(s): 4947Problem Description时间过的好快,一个学期就这么的过去原创 2016-01-14 20:19:51 · 698 阅读 · 0 评论 -
HDU 2018 复习时间
复习时间Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6375 Accepted Submission(s): 4682Problem Description为了能过个好年,xhd开始复习了,于是每天晚上背着书往教室跑。原创 2016-01-14 20:49:54 · 481 阅读 · 0 评论 -
hdu 1068 Girls and Boys
Problem Descriptionthe second year of the university somebody started a study on the romantic relations between the students. The relation “romantically involved” is defined between one girl and one原创 2016-03-03 16:09:41 · 247 阅读 · 0 评论 -
hdu 1102 Constructing Roads(最小生成树)
Problem 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 other. We say two village A and B are connec原创 2016-03-03 20:52:20 · 235 阅读 · 0 评论 -
hdu 1213 How Many Tables
Problem DescriptionToday is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the frien原创 2016-03-04 09:19:44 · 275 阅读 · 0 评论 -
hdu 2063 过山车
Problem DescriptionRPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐。但是,每个女孩都有各自的想法,举个例子把,Rabbit只愿意和XHD或PQK做partner,Grass只愿意和linle或LL做partner,PrincessSnow愿原创 2016-03-04 10:26:35 · 313 阅读 · 0 评论 -
hdu 1171 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 Softwar转载 2016-03-16 21:22:40 · 188 阅读 · 0 评论 -
蓝桥杯 分糖果
问题描述 有n个小朋友围坐成一圈。老师给每个小朋友随机发偶数个糖果,然后进行下面的游戏: 每个小朋友都把自己的糖果分一半给左手边的孩子。 一轮分糖后,拥有奇数颗糖的孩子由老师补给1个糖果,从而变成偶数。 反复进行这个游戏,直到所有小朋友的糖果数都相同为止。 你的任务是预测在已知的初始糖果情形下,老师一共需要补发多少个糖果。输入格式 程序首先读原创 2016-03-04 19:16:35 · 85 阅读 · 0 评论 -
蓝桥杯 六角填数
如图【1.png】所示六角形中,填入1~12的数字。使得每条直线上的数字之和都相同。数组分配 12 4 5 6 7 89 10 11 12 3图中,已经替你填好了3个数字,请你计算星号位置所代表的数字是多少?请通过浏览器提交答案,不要填写多余的内原创 2016-03-05 09:57:05 · 504 阅读 · 0 评论 -
hdu 2082 找单词
Problem Description假设有x1个字母A, x2个字母B,..... x26个字母Z,同时假设字母A的价值为1,字母B的价值为2,..... 字母Z的价值为26。那么,对于给定的字母,可以找到多少价值Input输入首先是一个整数N,代表测试实例的个数。然后包括N行数据,每行包括26个Output对于每个测试实例,请输出能找到的总价值原创 2016-03-18 11:26:08 · 269 阅读 · 0 评论 -
hdu 1398 Square Coins
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.,原创 2016-03-07 16:28:33 · 192 阅读 · 0 评论 -
hdu 1028 Ignatius and the Princess III
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原创 2016-03-07 16:41:51 · 362 阅读 · 0 评论 -
hdu 2079 课时间(题目已修改,注意读题)
Problem Description又到了选课的时间了,xhd看着选课表发呆,为了想让下一学期好过点,他想知道学n个学分共有多少组合。你来帮帮他吧。(xhd认为一样学分的课没区别)Input输入数据的第一行是一个数据T,表示有T组数据。每组数据的第一行是两个整数n(1 接着有k行,每行有两个整数a(1 Output对于每组输入数据,输出一个整数原创 2016-03-18 20:34:46 · 274 阅读 · 0 评论 -
hdu 2108 Shape of HDU
Problem Description话说上回讲到海东集团推选老总的事情,最终的结果是XHD以微弱优势当选,从此以后,“徐队”的称呼逐渐被“徐总”所取代,海东集团(HDU)也算是名副其实了。创业是需要地盘的,HDU向钱江肉丝高新技术开发区申请一块用地,很快得到了批复,据说这是因为他们公司研发的“海东牌”老鼠药科技含量很高,预期将占全球一半以上的市场。政府划拨的这块用地是一个多边形,为了描述转载 2016-03-18 21:26:32 · 366 阅读 · 0 评论 -
hdu 2700 Parity
Problem DescriptionA bit string has odd parity if the number of 1's is odd. A bit string has even parity if the number of 1's is even.Zero is considered to be an even number, so a bit string with no原创 2016-03-07 18:03:30 · 263 阅读 · 0 评论 -
hdu 2609 Coin Change
Problem DescriptionSuppose there are 5 types of coins: 50-cent, 25-cent, 10-cent, 5-cent, and 1-cent. We want to make changes with these coins for a given amount of money.For example, if we have原创 2016-03-19 15:12:49 · 211 阅读 · 0 评论 -
hdu 2065 "红色病毒"问题
Problem Description医学界发现的新病毒因其蔓延速度和Internet上传播的"红色病毒"不相上下,被称为"红色病毒",经研究发现,该病毒及其变种的DNA的一条单链中,胞嘧啶,腺嘧啶均是成对出现的。现在有一长度为N的字符串,满足一下条件:(1) 字符串仅由A,B,C,D四个字母组成;(2) A出现偶数次(也可以不出现);(3) C出现偶数次(也可以不出现);原创 2016-03-19 16:37:38 · 486 阅读 · 0 评论 -
hdu 1048 The Hardest Problem Ever
Problem DescriptionJulius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever faced was keeping himself alive. In order for him to survive, he decided to create one of t原创 2016-03-19 22:43:37 · 193 阅读 · 0 评论 -
hdu 1312 Red and Black (dfs+bfs)
Red and BlackTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15731 Accepted Submission(s): 9730Problem DescriptionThere is a rectangula原创 2016-04-03 11:39:05 · 254 阅读 · 0 评论 -
hdu 1009 FatMouse' Trade
Problem DescriptionFatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean.The warehouse has N rooms. The i-th room conta原创 2016-03-10 15:35:35 · 256 阅读 · 0 评论 -
hdu 1241 Oil Deposits
Problem DescriptionThe GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a原创 2016-04-04 11:53:17 · 244 阅读 · 0 评论 -
poj 3041 Asteroids
DescriptionBessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <= 500). The grid contains K asteroids (1 <= K <= 10,000), which are conv原创 2016-04-04 20:58:51 · 201 阅读 · 0 评论 -
蓝桥杯 牌型种数
小明被劫持到X赌城,被迫与其他3人玩牌。一副扑克牌(去掉大小王牌,共52张),均匀发给4个人,每个人13张。这时,小明脑子里突然冒出一个问题:如果不考虑花色,只考虑点数,也不考虑自己得到的牌的先后顺序,自己手里能拿到的初始牌型组合一共有多少种呢?请填写该整数,不要填写任何多余的内容或说明文字。#include#include#include#includeusing原创 2016-03-11 20:39:43 · 361 阅读 · 0 评论 -
hdu 1166 敌兵布阵
Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。原创 2016-04-09 17:39:14 · 189 阅读 · 0 评论 -
hdu 1556 color the balls
Problem DescriptionN个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a Input每个测试实例第一行为一个整数N,(N 当N = 0,输入结束。Output每个测试实例输出一行,包括N个整数,第I个数代表第I个气球总共被涂色的次数。Sample Input31 12 23 3转载 2016-04-09 17:49:09 · 230 阅读 · 0 评论 -
蓝桥杯 操作格子
问题描述有n个格子,从左到右放成一排,编号为1-n。共有m次操作,有3种操作类型:1.修改一个格子的权值,2.求连续一段格子权值和,3.求连续一段格子的最大值。对于每个2、3操作输出你所求出的结果。输入格式第一行2个整数n,m。接下来一行n个整数表示n个格子的初始权值。接下来m行,每行3个整数p,x,y,p表示操作类型,p=1原创 2016-04-13 15:37:59 · 304 阅读 · 0 评论 -
Rescue The Princess
DescriptionSeveral days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince who wanted to marry the princess set out immediately. Yet, the b原创 2016-04-13 20:58:41 · 302 阅读 · 0 评论 -
Hdu 1548 A strange lift
Problem DescriptionThere is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and down.When yo原创 2016-05-01 09:39:30 · 192 阅读 · 0 评论 -
Hdu 1372 Knight Moves
Problem DescriptionA friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves that visits each square of a given set of n原创 2016-05-01 10:36:31 · 220 阅读 · 0 评论 -
蓝桥杯 关联账户
为增大反腐力度,某地警方专门支队,对若干银行账户展开调查。如果两个账户间发生过转账,则认为有关联。如果a,b间有关联, b,c间有关联,则认为a,c间也有关联。对于调查范围内的n个账户(编号0到n-1),警方已知道m条因转账引起的直接关联。现在希望知道任意给定的两个账户,求出它们间是否有关联。有关联的输出1,没有关联输出0小明给出了如下的解决方案:#incl原创 2016-05-13 11:14:40 · 1059 阅读 · 1 评论 -
蓝桥杯 方格填数
在2行5列的格子中填入1到10的数字。要求:相邻的格子中的数,右边的大于左边的,下边的大于上边的。例子如图所示#include#include#include#include#define ll long longint map[2][5];int vis[20];int cnt;void check(){ int i,j; for (i=0;i<原创 2016-05-13 11:17:40 · 3203 阅读 · 0 评论 -
蓝桥杯 四阶幻方
把1~16的数字填入4x4的方格中,使得行、列以及两个对角线的和都相等,满足这样的特征时称为:四阶幻方。四阶幻方可能有很多方案。如果固定左上角为1,请计算一共有多少种方案。比如:1 2 15 1612 14 3 513 7 10 48 11 6 9以及:1 12 13 82 14 7 1115 3 10 616 5 4 9就可以算为两种不原创 2016-05-13 11:20:49 · 966 阅读 · 0 评论 -
蓝桥杯 穿越雷区
X星的坦克战车很奇怪,它必须交替地穿越正能量辐射区和负能量辐射区才能保持正常运转,否则将报废。某坦克需要从A区到B区去(A,B区本身是安全区,没有正能量或负能量特征),怎样走才能路径最短?已知的地图是一个方阵,上面用字母标出了A,B区,其它区都标了正号或负号分别表示正负能量辐射区。例如:A + - + -- + - - +- + + + -+ - + - +原创 2016-05-13 11:23:02 · 813 阅读 · 0 评论 -
Hdu 1085 Holding Bin-Laden Captive!
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 ter原创 2016-05-03 16:18:59 · 244 阅读 · 0 评论