- 博客(14)
- 收藏
- 关注
原创 FATE(二维完全背包)
最近xhd正在玩一款叫做FATE的游戏,为了得到极品装备,xhd在不停的杀怪做任务。久而久之xhd开始对杀怪产生的厌恶感,但又不得不通过杀怪来升完这最后一级。现在的问题是,xhd升掉最后一级还需n的经验值,xhd还留有m的忍耐度,每杀一个怪xhd会得到相应的经验,并减掉相应的忍耐度。当忍耐度降到0或者0以下时,xhd就不会玩这游戏。xhd还说了他最多只杀s只怪。请问他能升掉这最后一级吗?
2017-04-30 15:40:35 173
原创 棋盘问题 (dfs)
在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k <= n...
2017-04-24 13:13:32 247
原创 大数相乘 例 n的阶乘
#include#include#define mann 17000int f[mann];int main(){ int i,j,n; while(~scanf("%d",&n)) { memset(f,0,sizeof(f)); f[0]=1; for(int i=2; i
2017-04-24 12:20:20 209
原创 最大子段和
题目描述一个大小为n的数组a1到an(−10^4≤ai≤10^4)。请你找出一个连续子段,使子段长度为奇数,且子段和最大。输入第一行为T(1≤T≤5),代表数据组数。之后每组数据,第一行为n(1≤n≤10^5),代表数组长度。之后一行n个数,代表a1到an。输出每组数据输出一行,表示满足要求的子段和最大值样例输入141 2 3 4样例输出
2017-04-24 12:16:32 209
原创 Zoj2343
N robbers have robbed the bank. As the result of their crime they chanced to get M golden coins. Before the robbery the band has made an agreement that after the robbery i-th gangster would get Xi=Y o...
2017-04-20 20:00:14 2340
原创 完全背包
完全背包时间限制:3000 ms | 内存限制:65535 KB难度:4描述 直接说题意,完全背包定义有N种物品和一个容量为V的背包,每种物品都有无限件可用。第i种物品的体积是c,价值是w。求解将哪些物品装入背包可使这些物品的体积总和不超过背包容量,且价值总和最大。本题要求是背包恰好装满背包时,求出最大价值总和是多少。如果不能恰好装满背包,输出NO输入第一行: N 表示
2017-04-17 19:29:51 213
原创 Friends
Alice lives in the country where people like to make friends. The friendship is bidirectional and if any two person have no less thank friends in common, they will become friends in several days. Cu
2017-04-16 16:13:47 214
原创 CRB and His Birthday
Today is CRB's birthday. His mom decided to buy many presents for her lovely son.She went to the nearest shop with M Won(currency unit).At the shop, there are N kinds of presents.It costs
2017-04-15 10:27:17 233
原创 Proud Merchants HDU
Recently, iSea went to an ancient country. For such a long time, it was the most wealthy and powerful kingdom in the world. As a result, the people in this country are still very proud even if their n
2017-04-14 10:53:12 222
原创 洗牌问题
设2n张牌分别标记为1, 2, ..., n, n+1, ..., 2n,初始时这2n张牌按其标号从小到大排列。经一次洗牌后,原来的排列顺序变成n+1, 1, n+2, 2, ..., 2n, n。即前n张牌被放到偶数位置2, 4, ..., 2n,而后n张牌被放到奇数位置1, 3, ..., 2n-1。可以证明对于任何一个自然数n,经过若干次洗牌后可恢复初始状态。现在你的的任务是计算对于给定的n
2017-04-14 09:02:26 259
原创 并查集
https://cn.vjudge.net/contest/157779#problem/BLittle A gets to know a new friend, Little B, recently. One day, they realize that they are family 500 years ago. Now, Little A wants to know whether Litt...
2017-04-11 13:23:51 278
原创 Density of Power Network
ZOJ - 3708The vast power system is the most complicated man-made system and the greatest engineering innovation in the 20th century. The following diagram shows a typical 14 bus power system. In r
2017-04-07 17:56:18 223
原创 思路题
费马大定理:当n>2时,不定方程an+bn=cn没有正整数解。比如a3+b3=c3没有正整数解。为了活跃气氛,我们不妨来个搞笑版:把方程改成a3+b3=c3,这样就有解了,比如a=4, b=9, c=79时43+93=793。输入两个整数x, y, 求满足xInput输入最多包含10组数据。每组数据包含两个整数x, y(18)。Output对于每组数据,输出解的个数。Sam
2017-04-07 17:35:36 363
原创 大数
大数相乘例 n的阶乘#include#include#define mann 17000int f[mann];int main(){ int i,j,n; while(~scanf("%d",&n)) { memset(f,0,sizeof(f)); f[0]=1; for(int i
2017-04-05 20:33:16 167
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人