上一页 1 ··· 18 19 20 21 22
  2014年4月30日
摘要: 思路:简单动态规划,多重背包转化成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 阅读(74) 评论(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 阅读(89) 评论(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) 编辑
摘要: 取a的最后一位0-9,发现乘方个位数有周期关系(可以证明不大于4),找到周期和周期里对应的数,对于b直接查找即可#includeint T[5];int main(){ int a,b,i,j,temp,t,d; while(~scanf("%d%d",&a,&b)) { ... 阅读全文
posted @ 2014-04-30 18:34 wangzhili 阅读(87) 评论(0) 推荐(0) 编辑
摘要: 一个无向图存在欧拉回路,当且仅当该图拥有奇数度数的顶点的个数为0且该图是连通图。一个有向图存在欧拉回路,所有顶点的入度等于出度且该图是连通图。#include#includeint a[1005],father[1005],depth[1005];void init(int n){ int i... 阅读全文
posted @ 2014-04-30 18:34 wangzhili 阅读(74) 评论(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 阅读(68) 评论(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 阅读(65) 评论(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 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 并查集的应用注意是“有且仅有”就要保证最终只有一个集合,且每个点都只有一条路。#includeint father[100005],depth[100005];int a[200005];void init(){ int i; for(i = 1; i depth[y]) ... 阅读全文
posted @ 2014-04-30 18:33 wangzhili 阅读(99) 评论(0) 推荐(0) 编辑
摘要: #includeint father[1005],depth[1005];void init(){ int i; for(i = 1; i depth[y]) father[y] = father[x]; else { ... 阅读全文
posted @ 2014-04-30 18:33 wangzhili 阅读(84) 评论(0) 推荐(0) 编辑
上一页 1 ··· 18 19 20 21 22