上一页 1 ··· 5 6 7 8 9 10 11 12 13 下一页
摘要: Twilightgod CUSThttp://blog.csdn.net/twilightgodAekdycoin FZUhttp://hi.baidu.com/aekdycoinForeverlin HNUhttp://hi.baidu.com/forverlin1204/blogMatrix67 PKUhttp://www.matrix67.com/blog/watashi ZJUhttp://watashi.ws/blog/tag/zoj/Sha崽 HDUhttp://www.notonlysuccess.comChenyajunhttp://www.chenyajun.com/HH Z 阅读全文
posted @ 2013-08-28 23:08 湖心北斗 阅读(228) 评论(0) 推荐(0) 编辑
摘要: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=27749#problem/F直接使用组合进行计算,在打表的时候使用组合公式从下到上进行打表。注意不要使用long long 型的数乘以 double型的数而是直接用double 充当结果一路往下乘积,否则会wa。#include #include #include #include #define MAXN 55 using namespace std; typedef long long LL; double prb[MAXN]; int num[MAXN]; int ct[MAXN 阅读全文
posted @ 2013-08-08 00:04 湖心北斗 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 这个问题使用动态规划求解,dp[i][j]表示字符串下标为i的字符和下标为j的字符区间内构成回文所需加入的最少的字符串。当str[i]==str[j]时,则dp[i][j]=dp[i+1][j-1],当str[i]!=str[j]时,dp[i][j]=min(dp[i+1][j]+1,dp[i][j-1]+1),初始化时候,d[i][i]=0,d[i][i+1]=1(这里真是纠结了一个多小时,我还以为我转移方程错了!!!)。输出dp[0][strlen(str)-1].#include #include #include using namespace std; char str[1001]; 阅读全文
posted @ 2013-08-07 23:49 湖心北斗 阅读(517) 评论(0) 推荐(0) 编辑
摘要: 南阳理工学院动态规划专题括号问题2总结这道题目初看起来很简单,但是我从看题到思考,到做题ac足足花了一个晚上加一个下午的时间,我也有到网上找代码的习惯,但是都是递归,特别蛋疼,我想用正统的动归去做,于是就开始了不一样的艰难探索之旅。分析过程:使用char str[1001]这个字符数组保存最初输入的括号序列,使用dp[1001][1001]这个数组保存中间结果,dp[i][j]的意思是从下标为i的字符到下标为j的字符的子问题最少要加多少个括号才能规范化。首先dp数组初始化为零,显然dp[i][i]=1;至于dp[i][i+1],当str[i][i+1]配对的时候=0,当str[i][i+1]不 阅读全文
posted @ 2013-08-07 20:31 湖心北斗 阅读(316) 评论(0) 推荐(0) 编辑
摘要: http://acm.uva.es/local/online_judge/search_uva.html这题 的论证过程如下:假设l0=1,2,3,4,...,n-1,n;减掉数k之后剩下 1,2,3,...,k-1,0,1,2,3,4,...,n-k;则讲数列分成了两半l1=1,2,3,...,k-1,和l2=1,2,3,...,n-k;由于较短的数列是较长的数列的子集因此,相减的次数主要取决于较长的数列,于是有:fl0=fl2+1(|l2|>|l1|);或fl0=fl1+1(|l1|>|l2|),由此我们知道不管是l1还是l2都必须尽量的短,于是有|l1|=|l2|或者|l1| 阅读全文
posted @ 2013-07-31 23:43 湖心北斗 阅读(198) 评论(0) 推荐(0) 编辑
摘要: http://acm.uva.es/local/online_judge/search_uva.html这一题需要遍历所有的可能性,从第一行开始有2^n种可能,接下来的n-1行可以由第一行推测出来。主要是如何遍历的问题,我想了一个下午都没得到正确的答案,索性全部删除,借用书上的思路把代码敲出来,为什么一模一样呢?因为已经到了该无可改的地步了。精彩之处1.使用移位运算枚举第一行的所有可能性。2.比较a矩阵和b矩阵计算出要改变的零的个数。3.计算周围元素之和的sum条件语句也是非常精炼的。/* *1.枚举第一行的每个元素 *2.计算推测第二行至第n行的元素 *3.计算矩阵的不同元素个数获取ct值 阅读全文
posted @ 2013-07-31 20:15 湖心北斗 阅读(114) 评论(0) 推荐(0) 编辑
摘要: Problem DPiotr's AntsTime Limit: 2 seconds"One thing is for certain: there is no stopping them;the ants will soon be here. And I, for one, welcome ournew insect overlords." Kent Brockman Piotr likes playing with ants. He has n of them on a horizontal poleL cm long. Each ant is facing e 阅读全文
posted @ 2013-07-31 15:31 湖心北斗 阅读(238) 评论(0) 推荐(0) 编辑
摘要: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26275#problem/BB - Dividing a ChocolateCrawling in process...Crawling failedTime Limit:2000MSMemory Limit:65536KB64bit IO Format:%lld & %lluSubmitStatusPractice ZOJ 2705 DescriptionThe boy and Karlsson are dividing a chocolate that the boy 阅读全文
posted @ 2013-07-29 21:07 湖心北斗 阅读(134) 评论(0) 推荐(0) 编辑
摘要: B - BCrawling in process...Crawling failedTime Limit:500MSMemory Limit:4096KB64bit IO Format:%I64d & %I64uSubmitStatusPractice SGU 124 DescriptionThere is a closed broken line on a plane with sides parallel to coordinate axes, without self-crossings and self-contacts. The broken line consists of 阅读全文
posted @ 2013-07-28 00:38 湖心北斗 阅读(150) 评论(0) 推荐(0) 编辑
摘要: A - ACrawling in process...Crawling failedTime Limit:500MSMemory Limit:4096KB64bit IO Format:%I64d & %I64uSubmitStatusPractice SGU 123 DescriptionHere is your second problem, keep calm and solve it .Nacci sequence of numbers is known to all : F1 = 1; F2 = 1;Fn+1 =Fn + Fn-1, for n>1.You have t 阅读全文
posted @ 2013-07-28 00:20 湖心北斗 阅读(113) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 下一页