自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(42)
  • 收藏
  • 关注

原创 poj 3461 Oulipo

DescriptionThe French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter ‘e’. He was a member of the Oulipo group. A quote from the book:Tout avait Pair normal, m...

2019-04-25 21:27:34 198

原创 hdu 3068 最长回文

Problem Description给出一个只由小写英文字符a,b,c…y,z组成的字符串S,求S中最长回文串的长度.回文就是正反读都是一样的字符串,如aba, abba等Input输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c…y,z组成的字符串S两组case之间由空行隔开(该空行不用处理)字符串长度len <= 110000Output每一行一...

2019-04-25 15:49:23 138

原创 hdu1711 Number Sequence

Problem DescriptionGiven two sequences of numbers : a[1], a[2], … , a[N], and b[1], b[2], … , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to find a number K which make a[K] = ...

2019-04-25 10:31:53 182

原创 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 ...

2019-04-22 20:26:56 132

原创 hdu 1176 免费馅饼

Problem Description都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在游戏中是个身...

2019-04-21 22:09:05 97

原创 hdu 2041 超级楼梯

Problem Description有一楼梯共M级,刚开始时你在第一级,若每次只能跨上一级或二级,要走上第M级,共有多少种走法?Input输入数据首先包含一个整数N,表示测试实例的个数,然后是N行数据,每行包含一个整数M(1<=M<=40),表示楼梯的级数。Output对于每个测试实例,请输出不同走法的数量Sample Input223Sample Output...

2019-04-21 17:20:35 100

原创 hdu1087 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 to you...

2019-04-21 14:55:45 110

原创 hdu1159 Common Subsequence

Problem DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = <x1, x2, …, xm> another sequence Z = <z1, z2, …, ...

2019-04-20 21:22:43 108

原创 hdu1069 Monkey and Banana

Problem DescriptionA group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a building, and at the mean time, provide the monkey with some...

2019-04-20 20:46:47 121

原创 T1289:拦截导弹

【题目描述】某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统。但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能高于前一发的高度。某天,雷达捕捉到敌国的导弹来袭。由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹。输入导弹依次飞来的高度(雷达给出的高度数据是不大于30000的正整数),计算这套系统最多能拦截多少导弹。【输入】...

2019-04-20 19:29:17 604

原创 T1259:【例9.3】求最长不下降序列

【题目描述】设有由n(1≤n≤200)n(1≤n≤200)个不相同的整数组成的数列,记为:b(1)、b(2)、……、b(n)b(1)、b(2)、……、b(n)且b(i)≠b(j)(i≠j)b(i)≠b(j)(i≠j),若存在i1<i2<i3<…<iei1<i2<i3<…<ie 且有b(i1)<b(i2)<…<b(ie)b(i1)&...

2019-04-20 19:06:51 2792

原创 T1291:数字组合和T1273:【例9.17】货币系统

这两道题迷了我好久,终于看出来不同了(原谅我很菜,ε=(´ο`*))))T1291:数字组合题目中说的 n=5,5个数分别为1,2,3,4,5,t=5;那么可能的组合有5=1+4和5=2+3和5=5三种组合方式。 代表组合成最后的数字不同,即每种数字必须使用一次,也就是0-1背包问题的方案数,套用模板即可。#include<stdio.h>#include&lt...

2019-04-20 15:28:55 1664 1

原创 1273:【例9.17】货币系统

【题目描述】给你一个n种面值的货币系统,求组成面值为m的货币有多少种方案。【输入】第一行为n和m。【输出】一行,方案数。【输入样例】3 10125【输出样例】10这道题既可以用母函数(不知道为什么母函数一直过不了)也可以用dp的背包来做,但有点坑的是题目中并未给你数的范围,此时你应该设置大点的数组,并且为long long型的(wa了好几次,竟不知道原因…)AC代码...

2019-04-20 11:57:55 3674 2

原创 P1064 金明的预算方案

P1064 金明的预算方案题目描述金明今天很开心,家里购置的新房就要领钥匙了,新房里有一间金明自己专用的很宽敞的房间。更让他高兴的是,妈妈昨天对他说:“你的房间需要购买哪些物品,怎么布置,你说了算,只要不超过NN元钱就行”。今天一早,金明就开始做预算了,他把想买的物品分为两类:主件与附件,附件是从属于某个主件的,下表就是一些主件与附件的例子:主件 附件电脑 打印机,扫描仪书柜 图书书桌...

2019-04-20 11:20:09 194

原创 poj 2191 The Fewest Coins

DescriptionFarmer John has gone to town to buy some farm supplies. Being a very efficient man, he always pays for his goods in such a way that the smallest number of coins changes hands, i.e., the nu...

2019-04-19 19:57:30 151

原创 hdu 1114 Piggy-Bank

Problem DescriptionBefore ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irreversibly Bound Money (IBM). The i...

2019-04-19 10:36:23 114

原创 洛谷 P1049 装箱问题

题目描述有一个箱子容量为VV(正整数,0 \le V \le 200000≤V≤20000),同时有nn个物品(0<n \le 300<n≤30,每个物品有一个体积(正整数)。要求nn个物品中,任取若干个装入箱内,使箱子的剩余空间为最小。输入输出格式输入格式:11个整数,表示箱子容量11个整数,表示有nn个物品接下来nn行,分别表示这nn个物品的各自体积输出格式:11...

2019-04-19 09:22:16 224

原创 hdu1061 Rightmost Digit

Problem DescriptionGiven a positive integer N, you should output the most right digit of N^N.InputThe input contains several test cases. The first line of the input is a single integer T which is t...

2019-04-18 20:08:35 140

原创 hdu 1284 钱币兑换问题

Problem Description在一个国家仅有1分,2分,3分硬币,将钱N兑换成硬币有很多种兑法。请你编程序计算出共有多少种兑法。Input每行只有一个正整数N,N小于32768。Output对应每个输入,输出兑换方法数。Sample Input293412553Sample Output71883113137761典型母函数应用,第一次做的时候没有打表,TLE了。...

2019-04-18 19:38:19 162

原创 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 underg...

2019-04-18 19:34:19 139

原创 蔡勒星期公式(根据日期计算出周几)

#include<stdio.h>int Change(int year,int month,int day)//根据日期判断出星期几 { if(month==1||month==2)//所求月份为1月或2月,应视为前一年的13月或14月; { month+=12; year--; } int c=year/100...

2019-04-18 09:59:32 433

原创 hdu1406 完数

Problem Description完数的定义:如果一个大于1的正整数的所有因子之和等于它的本身,则称这个数是完数,比如6,28都是完数:6=1+2+3;28=1+2+4+7+14。本题的任务是判断两个正整数之间完数的个数。Input输入数据包含多行,第一行是一个正整数n,表示测试实例的个数,然后就是n个测试实例,每个实例占一行,由两个正整数num1和num2组成,(1<num1,...

2019-04-17 21:00:13 108

原创 hdu 2069 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 11 ...

2019-04-17 19:17:53 124

原创 hdu1297 Children’s Queue

Problem DescriptionThere are many students in PHT School. One day, the headmaster whose name is PigHeader wanted all students stand in a line. He prescribed that girl can not be in single. In other w...

2019-04-17 15:42:48 151

原创 hdu1290 献给杭电五十周年校庆的礼物

Problem Description或许你曾经牢骚满腹或许你依然心怀忧伤或许你近在咫尺或许你我天各一方对于每一个学子母校永远航行在生命的海洋今年是我们杭电建校五十周年,这是一个值得祝福的日子。我们该送给母校一个怎样的礼物呢?对于目前的大家来说,最好的礼物当然是省赛中的好成绩,我不能参赛,就送给学校一个DOOM III球形大蛋糕吧,这可是名牌,估计要花掉我半年的银子呢。想象着正...

2019-04-17 11:18:14 123

原创 hdu1286 找新朋友

Problem Description新年快到了,“猪头帮协会”准备搞一个聚会,已经知道现有会员N人,把会员从1到N编号,其中会长的号码是N号,凡是和会长是老朋友的,那么该会员的号码肯定和N有大于1的公约数,否则都是新朋友,现在会长想知道究竟有几个新朋友?请你编程序帮会长计算出来。Input第一行是测试数据的组数CN(Case number,1<CN<10000),接着有CN行正...

2019-04-17 09:29:21 113

原创 hdu 1212 Big Number

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 p...

2019-04-16 21:26:37 90

原创 hdu1205 吃糖果

Problem DescriptionHOHO,终于从Speakless手上赢走了所有的糖果,是Gardon吃糖果时有个特殊的癖好,就是不喜欢将一样的糖果放在一起吃,喜欢先吃一种,下一次吃另一种,这样;可是Gardon不知道是否存在一种吃糖果的顺序使得他能把所有糖果都吃完?请你写个程序帮忙计算一下。Input第一行有一个整数T,接下来T组数据,每组数据占2行,第一行是一个整数N(0<N...

2019-04-16 20:36:15 255

原创 杭电 1196 Lowest Bit

Problem DescriptionGiven an positive integer A (1 <= A <= 100), output the lowest bit of A.For example, given A = 26, we can write A in binary form as 11010, so the lowest bit of A is 10, so t...

2019-04-16 19:52:18 133

原创 杭电 1164 Eddy's research I

Problem DescriptionEddy’s interest is very extensive, recently he is interested in prime number. Eddy discover the all number owned can be divided into the multiply of prime number, but he can’t writ...

2019-04-16 17:31:50 157

原创 hdu 1058 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 terribl...

2019-04-16 16:03:21 196

原创 杭电 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 equa...

2019-04-16 11:21:38 164

原创 杭电1019 Least Common Multiple

Problem DescriptionThe least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5, 7 and 15...

2019-04-16 09:51:45 94

原创 poj 3211 Washing Clothes

DescriptionDearboy was so busy recently that now he has piles of clothes to wash. Luckily, he has a beautiful and hard-working girlfriend to help him. The clothes are in varieties of colors but each ...

2019-04-15 16:49:43 134

原创 hdu 1712 ACboy needs your help

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 arr...

2019-04-15 14:51:58 116

原创 T1292:宠物小精灵之收服

【题目描述】宠物小精灵是一部讲述小智和他的搭档皮卡丘一起冒险的故事。一天,小智和皮卡丘来到了小精灵狩猎场,里面有很多珍贵的野生宠物小精灵。小智也想收服其中的一些小精灵。然而,野生的小精灵并不那么容易被收服。对于每一个野生小精灵而言,小智可能需要使用很多个精灵球才能收服它,而在收服过程中,野生小精灵也会对皮卡丘造成一定的伤害(从而减少皮卡丘的体力)。当皮卡丘的体力小于等于0时,小智就必须结束狩猎...

2019-04-15 09:23:58 1972 1

原创 T1271:【例9.15】潜水员

【题目描述】潜水员为了潜水要使用特殊的装备。他有一个带2种气体的气缸:一个为氧气,一个为氮气。让潜水员下潜的深度需要各种的数量的氧和氮。潜水员有一定数量的气缸。每个气缸都有重量和气体容量。潜水员为了完成他的工作需要特定数量的氧和氮。他完成工作所需气缸的总重的最低限度的是多少?例如:潜水员有5个气缸。每行三个数字为:氧,氮的(升)量和气缸的重量:3 36 12010 25 1295 50 ...

2019-04-14 21:27:31 1201

原创 T1270:【例9.14】混合背包

【题目描述】一个旅行者有一个最多能装V公斤的背包,现在有n件物品,它们的重量分别是W1,W2,…,WnW1,W2,…,Wn,它们的价值分别为C1,C2,…,CnC1,C2,…,Cn。有的物品只可以取一次(01背包),有的物品可以取无限次(完全背包),有的物品可以取的次数有一个上限(多重背包)。求解将哪些物品装入背包可使这些物品的费用总和不超过背包容量,且价值总和最大。【输入】第一行:二个整数...

2019-04-14 19:57:27 559

原创 杭电 2191 悼念512汶川大地震遇难同胞——珍惜现在,感恩生活

Problem Description急!灾区的食物依然短缺!为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买。请问:你用有限的资金最多能采购多少公斤粮食呢?后记:人生是一个充满了变数的生命过程,天灾、人祸、病痛是我们生命历程中不可预知的威胁。月有阴晴圆缺,人有旦夕祸福,...

2019-04-14 16:12:58 116

原创 杭电 2007平方和与立方和

Problem Description给定一段连续的整数,求出他们中所有偶数的平方和以及所有奇数的立方和。Input输入数据包含多组测试实例,每组测试实例包含一行,由两个整数m和n组成。Output对于每组输入数据,输出一行,应包括两个整数x和y,分别表示该段连续的整数中所有偶数的平方和以及所有奇数的立方和。你可以认为32位整数足以保存结果。Sample Input1 32 5...

2019-04-13 21:52:49 109

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除