摘要:
思路:简单动态规划,多重背包转化成0 1背包问题#include#includeint a[101][2001],rcw[2001],rcp[2001];int max(int x,int y){ return x>y?x:y;}int main(){ int C,i,j,k,pg,n,... 阅读全文
posted @ 2014-04-30 18:34
wangzhili
阅读(76)
评论(0)
推荐(0)
摘要:
思路:简单的动态规划,0-1背包问题#include#includeint a[1001][1001],va[1001],vo[1001];int max(int x, int y){ return x>y?x:y;}int main(){ int T,i,j,n,v; scanf... 阅读全文
posted @ 2014-04-30 18:34
wangzhili
阅读(93)
评论(0)
推荐(0)
摘要:
首先,若想使余额最少应该从这m元中首先取出5元用来买最贵的菜,剩下的m-5元就是求在剩下n-1种的菜中的最大花销了,状态转移方程式 :moy[i][j] = max(moy[i][j-1],moy[i-a[j]][j-1]),moy[i][j]表示预算为i时,试买第j个菜的最大花销#include#... 阅读全文
posted @ 2014-04-30 18:34
wangzhili
阅读(98)
评论(0)
推荐(0)
摘要:
一个无向图存在欧拉回路,当且仅当该图拥有奇数度数的顶点的个数为0且该图是连通图。一个有向图存在欧拉回路,所有顶点的入度等于出度且该图是连通图。#include#includeint a[1005],father[1005],depth[1005];void init(int n){ int i... 阅读全文
posted @ 2014-04-30 18:34
wangzhili
阅读(77)
评论(0)
推荐(0)
摘要:
#includeint a[1005];int main(){ int T,x,k,j; while(~scanf("%d",&T)) { a[1] = 30010; k = 1; while(T--) { ... 阅读全文
posted @ 2014-04-30 18:34
wangzhili
阅读(71)
评论(0)
推荐(0)
摘要:
#includelong long int a[21];long long int fun(int n,int m){ int i; long long int sum = 1; m = m>(n-m)?n-m:m; for(i = 1; i <= m; i ++) ... 阅读全文
posted @ 2014-04-30 18:34
wangzhili
阅读(68)
评论(0)
推荐(0)
摘要:
水题,结构题二级排序,在对编号进行逆序排序#include#include#includetypedef struct { float sa; int nu;}Node;Node logo[105];int temp[105];int comp1(const void *a,const ... 阅读全文
posted @ 2014-04-30 18:34
wangzhili
阅读(92)
评论(0)
推荐(0)
摘要:
思路:数学题,把每个数字对应的行号(1,2,3。。。。。)算出来,行号h = sqrt(n)为整数则不加1,否则加1,得到的就是行号,再分别算出从左边和从右边起的列号(1,2,3。。。),右列号rl = (h*h-n)/2+1,左列号ll = (n-((h-1)*(h-1)+1))/2+1,然后两个... 阅读全文
posted @ 2014-04-30 18:34
wangzhili
阅读(111)
评论(0)
推荐(0)
摘要:
#includeint main(){ int a,c,n,i,j,low,high,sum,max,con = 0; scanf("%d",&c); while(c--) { con++; sum = 0; low = high =... 阅读全文
posted @ 2014-04-30 18:34
wangzhili
阅读(71)
评论(0)
推荐(0)
摘要:
#include#includechar str[10001];int main(){ int T,i,cnt,len; char *p,*q; scanf("%d",&T); while(T--) { cnt = 1; scanf("%s"... 阅读全文
posted @ 2014-04-30 18:34
wangzhili
阅读(68)
评论(0)
推荐(0)
浙公网安备 33010602011771号