OJ题目
KeepTing
java开发工程师
展开
-
hdu 5512 (Pagodas) 2015 ACM/ICPC 亚洲区沈阳赛区 (题目编号1004)
Problem Descriptionn pagodas were standing erect in Hong Jue Si between the Niushou Mountain and the Yuntai Mountain, labelled from 1 to n. However, only two of them (labelled a and b, where 1≤a≠b≤n原创 2015-10-31 21:32:59 · 1966 阅读 · 0 评论 -
HDU 1157 Who's in the Middle (快速排序)
Problem DescriptionFJ is surveying his herd to find the most average cow. He wants to know how much milk this 'median' cow gives: half of the cows give as much or more than the median; half give as原创 2015-08-17 15:43:50 · 364 阅读 · 0 评论 -
hdu 1500 Chopsticks(动态规划)
Problem DescriptionIn China, people use a pair of chopsticks to get food on the table, but Mr. L is a bit different. He uses a set of three chopsticks -- one pair, plus an EXTRA long chopstick to ge原创 2015-09-07 21:10:05 · 441 阅读 · 0 评论 -
hdu 2602 Bone Collector (0-1背包)
Problem DescriptionMany years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went to the grave原创 2015-09-07 21:14:03 · 383 阅读 · 0 评论 -
hdu 2084 数塔(动态规划)
Problem Description在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的:有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少?已经告诉你了,这是个DP的题目,你能AC吗?Input输入数据首先包括一个整数C,表示测试实例的个数,每个测试实例的第一行是一个整数N(1原创 2015-09-07 21:16:56 · 290 阅读 · 0 评论 -
hdu 1081 To The Max最大矩阵和(动态规划)
Problem DescriptionGiven a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1 x 1 or greater located within the whole array. The sum of a原创 2015-09-07 21:27:15 · 306 阅读 · 0 评论 -
hdu 1466 计算直线的交点数
Problem Description平面上有n条直线,且无三线共点,问这些直线能有多少种不同交点数。比如,如果n=2,则可能的交点数量为0(平行)或者1(不平行)。Input输入数据包含多个测试实例,每个测试实例占一行,每行包含一个正整数n(nOutput每个测试实例对应一行输出,从小到大列出所有相交方案,其中每个数为可能的交点数,每行的整数之间用一个空格原创 2015-09-13 21:30:34 · 363 阅读 · 0 评论 -
hdu 1018 -Big Number(求n的阶乘的位数)
Problem DescriptionIn many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you are原创 2015-09-20 19:23:47 · 315 阅读 · 0 评论 -
hdu 1051-Wooden Sticks
Problem DescriptionThere is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woodworking machine in one by one fashion. It nee原创 2015-09-21 21:02:50 · 279 阅读 · 0 评论 -
hdu 1050 Moving Tables(贪心算法)
Problem DescriptionThe famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure.The floor has 200 rooms each on the north side and原创 2015-09-28 20:39:20 · 458 阅读 · 0 评论 -
HDU-1087(Super Jumping! Jumping! Jumping!)
Problem DescriptionNowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it t原创 2015-10-25 20:33:59 · 364 阅读 · 0 评论 -
HDU 2817 A sequence of numbers (数学+快速幂)
Problem DescriptionXinlv wrote some sequences on the paper a long time ago, they might be arithmetic or geometric sequences. The numbers are not very clear now, and only the first three numbers of e原创 2016-08-06 16:38:14 · 479 阅读 · 0 评论 -
HDU 5804 Price List
Problem DescriptionThere are n shops numbered with successive integers from 1 to n in Byteland. Every shop sells only one kind of goods, and the price of the i-th shop's goods is vi.Every day, B原创 2016-08-08 07:03:15 · 378 阅读 · 5 评论 -
POJ 2000 Gold Coins(模拟)
Gold CoinsTime Limit: 1000MS Memory Limit: 30000KDescriptionThe king pays his loyal knight in gold coins. On the first day of his service, the knight receives one gold coin. On原创 2016-09-02 07:09:49 · 376 阅读 · 0 评论 -
POJ 2084 Game of Connections(大数+卡特兰数)
Game of ConnectionsTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 8331Accepted: 4141DescriptionThis is a small but ancient g原创 2016-11-05 20:24:27 · 680 阅读 · 2 评论 -
HDU-1079 Calendar Game (简单博弈)
Calendar GameTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3935 Accepted Submission(s): 2374Problem DescriptionAdam and Eve ent原创 2016-10-16 19:07:21 · 619 阅读 · 3 评论 -
HDU 5902 GCD is Funny(GCD)
GCD is FunnyTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 468 Accepted Submission(s): 125Problem DescriptionAlex has invent原创 2016-09-30 11:29:06 · 557 阅读 · 0 评论 -
1000的阶乘-HDU 1042-大数阶乘(万进制思想)
思路: 即用数组a,数组中的每个元素存储4位数,, 比如,计算9的阶乘,在计算到7的阶乘时,7!为5040,可以用a[0]存储5040,没有产生进位,然后8!=5040*8=40320,如果看成万进制则产生了进位,那么a[0]=320(注意输出时不足4位的要在前边补0),a[1]=4(最高位不用补0),9!=40320*9,那么a[0]*9=320*9=...原创 2016-10-02 20:32:41 · 1588 阅读 · 0 评论 -
POJ 1833 排列(水)
排列Time Limit: 1000MS Memory Limit: 30000KTotal Submissions: 19063 Accepted: 7429Description题目描述: 大家知道,给出正整数n,则1到n这n个数可以构成n!种排列,把这些排列按照从小到大的顺序(字典顺序)列出,如n=3时,列出1 2原创 2016-11-05 10:01:24 · 343 阅读 · 0 评论 -
HDU 5858 Hard problem(几何)
Hard problemTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 364 Accepted Submission(s): 271Problem Descriptioncjj is fun with m原创 2016-09-21 15:42:46 · 370 阅读 · 0 评论 -
2016中国大学生程序设计竞赛 1004 Danganronpa
Problem DescriptionChisa Yukizome works as a teacher in the school. She prepares many gifts, which consist of n kinds with a[i] quantities of each kind, for her students and wants to hold a class me原创 2016-08-14 18:05:09 · 643 阅读 · 0 评论 -
HDU 2091 空心三角形
Problem Description把一个字符三角形掏空,就能节省材料成本,减轻重量,但关键是为了追求另一种视觉效果。在设计的过程中,需要给出各种花纹的材料和大小尺寸的三角形样板,通过电脑临时做出来,以便看看效果。 Input每行包含一个字符和一个整数n(0 Output每个样板三角形之间应空上一行,三角形的中间为空。显然行末没有多余的空格。原创 2016-08-14 10:45:00 · 957 阅读 · 1 评论 -
HDU 1251 统计难题(字典树模板)
Problem DescriptionIgnatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提原创 2016-09-17 09:45:46 · 376 阅读 · 0 评论 -
POJ 2081 Recaman's Sequence (递推)
Recaman's SequenceTime Limit: 3000MS Memory Limit: 60000KDescriptionThe Recaman's sequence is defined by a0 = 0 ; for m > 0, am = am−1 − m if the rsulting am is positive and not alr原创 2016-09-02 07:33:37 · 800 阅读 · 0 评论 -
HDU-2159(FATE)
Problem Description最近xhd正在玩一款叫做FATE的游戏,为了得到极品装备,xhd在不停的杀怪做任务。久而久之xhd开始对杀怪产生的厌恶感,但又不得不通过杀怪来升完这最后一级。现在的问题是,xhd升掉最后一级还需n的经验值,xhd还留有m的忍耐度,每杀一个怪xhd会得到相应的经验,并减掉相应的忍耐度。当忍耐度降到0或者0以下时,xhd就不会玩这游戏。xhd还说了他最原创 2015-10-26 20:59:55 · 300 阅读 · 0 评论 -
HDU-3177 Crixalis's Equipment
Problem DescriptionCrixalis - Sand King used to be a giant scorpion(蝎子) in the deserts of Kalimdor. Though he's a guardian of Lich King now, he keeps the living habit of a scorpion like living u原创 2015-11-29 21:36:20 · 421 阅读 · 0 评论 -
hdu-5597 GTW likes function
Problem DescriptionNow you are given two definitions as follows.f(x)=∑xk=0(−1)k22x−2kCk2x−k+1,f0(x)=f(x),fn(x)=f(fn−1(x))(n≥1)Note that φ(n) means Euler’s totient function.(φ(n)is an arithme原创 2015-12-13 10:32:54 · 541 阅读 · 0 评论 -
HDU 1280 前m大的数
Problem Description还记得Gardon给小希布置的那个作业么?(上次比赛的1005)其实小希已经找回了原来的那张数表,现在她想确认一下她的答案是否正确,但是整个的答案是很庞大的表,小希只想让你把答案中最大的M个数告诉她就可以了。给定一个包含N(NInput输入可能包含多组数据,其中每组数据包括两行:第一行两个数N和M,第二行N个数,表示该序列。原创 2016-03-06 07:54:31 · 449 阅读 · 0 评论 -
HDU 1260 Tickets (DP)
Problem DescriptionJesus, what a great movie! Thousands of people are rushing to the cinema. However, this is really a tuff time for Joe who sells the film tickets. He is wandering when could he go原创 2016-03-06 09:30:10 · 238 阅读 · 0 评论 -
HDU 1907 John (尼姆博弈)
Problem DescriptionLittle John is playing very funny game with his younger brother. There is one big box filled with M&Ms of different colors. At first John has to eat several M&Ms of the same color原创 2016-03-06 18:35:14 · 314 阅读 · 0 评论 -
HDU 2105 The Center of Gravity (水题)
Problem DescriptionEveryone know the story that how Newton discovered the Universal Gravitation. One day, Newton walkedleisurely, suddenly, an apple hit his head. Then Newton discovered the Univer原创 2016-03-08 07:44:04 · 659 阅读 · 0 评论 -
HDU 2176 取(m堆)石子游戏 (尼姆博弈)
Problem Descriptionm堆石子,两人轮流取.只能在1堆中取.取完者胜.先取者负输出No.先取者胜输出Yes,然后输出怎样取子.例如5堆 5,7,8,9,10先取者胜,先取者第1次取时可以从有8个的那一堆取走7个剩下1个,也可以从有9个的中那一堆取走9个剩下0个,也可以从有10个的中那一堆取走7个剩下3个.Input输入有多组.每组第1行是m,mOut原创 2016-03-08 09:38:29 · 343 阅读 · 0 评论 -
HDU 1850 Being a Good Boy in Spring Festival (尼姆博弈)
Problem Description一年在外 父母时刻牵挂春节回家 你能做几天好孩子吗寒假里尝试做做下面的事情吧陪妈妈逛一次菜场悄悄给爸爸买个小礼物主动地 强烈地 要求洗一次碗某一天早起 给爸妈用心地做回早餐如果愿意 你还可以和爸妈说咱们玩个小游戏吧 ACM课上学的呢~下面是一个二人小游戏:桌子上有M堆扑克牌;每堆牌的数量分别为Ni(i=1…M原创 2016-03-08 09:43:09 · 371 阅读 · 0 评论 -
HDU 2149 Public Sale (巴什博奕)
Problem Description虽然不想,但是现实总归是现实,Lele始终没有逃过退学的命运,因为他没有拿到奖学金。现在等待他的,就是像FarmJohn一样的农田生涯。要种田得有田才行,Lele听说街上正在举行一场别开生面的拍卖会,拍卖的物品正好就是一块20亩的田地。于是,Lele带上他的全部积蓄,冲往拍卖会。后来发现,整个拍卖会只有Lele和他的死对头Yueyue。原创 2016-03-10 16:40:08 · 284 阅读 · 0 评论 -
HDU 1002 A + B Problem II (JAVA大数)
Problem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.InputThe first line of the input contains an integer T(1<=T<=20原创 2016-03-11 17:43:11 · 386 阅读 · 0 评论 -
HDU 2154 跳舞毯 (递推)
Problem Description由于长期缺乏运动,小黑发现自己的身材臃肿了许多,于是他想健身,更准确地说是减肥。小黑买来一块圆形的毯子,把它们分成三等分,分别标上A,B,C,称之为“跳舞毯”,他的运动方式是每次都从A开始跳,每次都可以任意跳到其他块,但最后必须跳回A,且不能原地跳.为达到减肥效果,小黑每天都会坚持跳n次,有天他突然想知道当他跳n次时共几种跳法,结果想了好几天没想出来-原创 2016-03-12 14:57:39 · 2734 阅读 · 0 评论 -
HDU 1250 Hat's Fibonacci (JAVA大数)
Problem DescriptionA Fibonacci sequence is calculated by adding the previous two members the sequence, with the first two members being both 1.F(1) = 1, F(2) = 1, F(3) = 1,F(4) = 1, F(n>4) = F(n -原创 2016-03-10 17:01:26 · 379 阅读 · 0 评论 -
HDU 2544 最短路 (弗洛伊德模板)
Problem Description在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?Input输入包括多组数据。每组数据第一行是两个整数N、M(N输入保证至少存在1条商店到赛场的路线。Output原创 2016-03-06 07:42:27 · 842 阅读 · 0 评论 -
HDU 2547 无剑无我 (大水题)
Problem Description北宋末年,奸臣当道,宦官掌权,外侮日亟,辽军再犯。时下战火连连,烽烟四起,哀鸿遍野,民不聊生,又有众多能人异士群起而反,天下志士云集响应,景粮影从。值此危急存亡之秋,在一个与世隔绝的地方---MCA山上一位江湖人称的人正在为抗击辽贼研究剑法,终于于一雷电交加之夜精确计算出了荡剑回锋的剑气伤害公式。定义 f(x, y, m, n) = sqrt(原创 2016-03-05 16:51:00 · 383 阅读 · 0 评论 -
HDU 1232 畅通工程 (dfs、并查集)
Problem Description某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路?Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( 注意:两个城市之原创 2016-01-21 10:50:09 · 427 阅读 · 0 评论