会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
禅境花园
新博客 http://xiang578.github.io/
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
29
30
31
32
33
34
35
36
37
下一页
2015年2月22日
uva 437 The Tower of Babylon
摘要: DAG最长路算法,算法竞赛入门经典p269#include#include#includeusing namespace std;int v[35][3],d[35][3],n;void f(int* p,int x,int y){ int temp=0,i; for(i...
阅读全文
posted @ 2015-02-22 15:39 xryz
阅读(116)
评论(0)
推荐(0)
2015年2月21日
uva 562 Dividing coins
摘要: 题意是将这些硬币分成两份,差值要最小,并输出 先求硬币总价值,然后考虑一个只有总价值一半的01背包#include#include#include#include#includeusing namespace std;int main(){ int n,m,i,j,a[105]...
阅读全文
posted @ 2015-02-21 21:36 xryz
阅读(81)
评论(0)
推荐(0)
uva 10003 Cutting Sticks
摘要: #include#include#include#include#includeusing namespace std;int vis[55][55],d[55][55],a[55];int dp(int i,int j){ if(i>=j-1) return 0; if...
阅读全文
posted @ 2015-02-21 12:19 xryz
阅读(88)
评论(0)
推荐(0)
2015年2月20日
uva 10130 SuperSale
摘要: #include#include#include#include#includeusing namespace std;int main(){ int cas,i,j,n,p[1024],w[1024],g[105],m,dp[1024],sum; scanf("%d",...
阅读全文
posted @ 2015-02-20 19:42 xryz
阅读(79)
评论(0)
推荐(0)
2015年2月18日
uva 10404 Bachet's Game
摘要: 自己没想到动态规划怎么写,看了其他人的解释才明白。用一个dp数组记录s是否能赢(状态为1)。 如果dp[i]为1,dp[i+加上任何一个可以移动的块数]必定为0。反过来也是成立的。#include#includeint main(){ int n,m,i,a[15],j,dp[...
阅读全文
posted @ 2015-02-18 23:45 xryz
阅读(129)
评论(0)
推荐(0)
uva 624 CD
摘要: #include#includeint main(){ int n,t,dp[10005],c[25][10005],v[10005],i,j; while(~scanf("%d%d",&n,&t)) { for(i=0;i=v[i];j--) ...
阅读全文
posted @ 2015-02-18 14:11 xryz
阅读(98)
评论(0)
推荐(0)
uva 10465 Homer Simpson
摘要: #include#include#include#include#includeusing namespace std;int main(){ int m,n,t,max,sum,i,j; while(~scanf("%d%d%d",&m,&n,&t)) { ...
阅读全文
posted @ 2015-02-18 13:23 xryz
阅读(120)
评论(0)
推荐(0)
uva 147 Dollars
摘要: 输出的种类书要用 long long int型,%lf三位要用%6.2f。 第一个输出也可以用%d.%d读入,%3d.%.2d输出。 数据可以缩小5倍再处理。#include#includeint main(){ int i,j,c[12]={1,2,4,10,20,40,10...
阅读全文
posted @ 2015-02-18 10:21 xryz
阅读(101)
评论(0)
推荐(0)
2015年2月17日
uva 674 Coin Change
摘要: 考虑最后一个硬币是什么再加上之前的就好了。#include#include#include#include#includeusing namespace std;int main(){ int n,i,j,a[8000],coin[5]={1,5,10,25,50}; m...
阅读全文
posted @ 2015-02-17 18:47 xryz
阅读(75)
评论(0)
推荐(0)
uva 10405 Longest Common Subsequence
摘要: 最长公共子序列 解析见uva 111的博文不知道为什么用scanf读入字符串会有问题,改成gets就好了#include#include#include#include#includeusing namespace std;int main(){ int i,j,l1,l2,d...
阅读全文
posted @ 2015-02-17 15:21 xryz
阅读(108)
评论(0)
推荐(0)
上一页
1
···
29
30
31
32
33
34
35
36
37
下一页
公告