上一页 1 ··· 3 4 5 6 7 8 下一页
摘要: 没有AC它,但是我已经试过很多例子了,都通过,所以放弃做它了,贴上我的错误代码,这道题目要注意它的数值,150000啊,时限又是1秒,也就是10的9次方,如果你用了两重循环,可想而知,超过那个最大值,所以只能有一重循环,dp中一重循环的,我只有在最大非递增序列看到,还有那道hehe中见到,所以我尝试了一下跟hehe的算法,时间上符合题目的要求了,可是还是通不过,蛋碎啊#include "string.h"#include "iostream"using namespace std;int f[101000][510];int n,num[101000], 阅读全文
posted @ 2013-08-19 11:21 龙城星 阅读(272) 评论(0) 推荐(0) 编辑
摘要: 自己粗心大意了啊,结果没有通过#include "iostream"#include "string.h"using namespace std;int maxb(int a,int b){return a>b?a:b;}int f[10000][10000];int main(){ int Case,i,num,j,list[10010],sum,max,k,s1,s,e,min,v,m; cin>>Case; for(m=1;m>num; for(j=1;j>list[j]; max=list[1];s=1;e=1; f 阅读全文
posted @ 2013-08-19 11:14 龙城星 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 居然在最后的输出形式那里卡了很久,忘记除10007,忘记输出Case 希望下次不要犯这种错误#include "iostream"#include "string.h"using namespace std;int f[10100][100],maxb=0;char list[110][10100];int max(int a,int b){return a>b?a:b;}void work(){ int i,count,flag,j,num; memset(f,0,sizeof(f)); f[0][0]=1; f[1][0]=1; f[2][0] 阅读全文
posted @ 2013-08-18 00:26 龙城星 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 这道题目,整个过程都是自己做的,其中j的取值比较讲究技巧,%k——————————————通过了#include "iostream"#include "string.h"#include "algorithm"using namespace std;int f[11000][110];int n,k,i,list[10100],s,e,j,flag;bool cmp(int a,int b){ return a>b;}int main(){ cin>>n>>k; for(i=1;i>list[i] 阅读全文
posted @ 2013-08-17 14:55 龙城星 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 1038Bugs Integrated, Inc.状态压缩,现在还做不了,先把dp中简单的题目做完吧 阅读全文
posted @ 2013-08-16 13:08 龙城星 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 这个答案解决了我的一个疑惑,作为背包问题,f[i]表示是能与不能,但做到这个还不够,我们还要找到最好的一个,也就是说实现与找到的分开//////////////////////////////////////////////////////////////////////////// POJ1036 Gangsters// Memory: 284K Time: 0MS// Language: C++ Result: Accepted//////////////////////////////////////////////... 阅读全文
posted @ 2013-08-15 15:29 龙城星 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 多重背包问题#include#include#define maxn 420000+5using namespace std;int dp[maxn];int w[100];int main(){ int t=0; while(1){ t++; int a[10]; int m=0; for(int i=1;i>a[i]; m=m+i*a[i]; } if (m%2!=0) { couts){ total++; ... 阅读全文
posted @ 2013-08-14 20:35 龙城星 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 水题来的,重合程度最大的,对应最大的时间#include#includeusing namespace std;int main(){ int i,j,t,n,q[201]; cin>>t; while(t--) { memset(q,0,sizeof(q)); cin>>n; for(i=0;i>a>>b; if(a>b) { t=a;a=b;b=t; } if(a%2) a++;... 阅读全文
posted @ 2013-08-14 13:42 龙城星 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 我的代码超时了,多么简洁的代码啊!!!!!!!就这样超时了#include "iostream"using namespace std;int main(){ int n,i,j,k,l,table[100][100],max,p,q,total; cin>>n; for(i=0;i>table[i/n][i%n]; } max=0; for(i=0;imax)max=total; } cout#include #include #include #define MAX(a,b) (a) > (b)? (a):(b)#define MIN(a,b) 阅读全文
posted @ 2013-08-14 11:11 龙城星 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 又是一道没有通过的题目例子都对了,就是出错啊我的代码坑爹的没有通过,其中列举了我的两种方法,第二种做到我蛋碎,混乱啊#include "iostream"using namespace std;int main(){ int n,i=0,c,k,j,flag,mid,max=0,l; float num[1100],d[1100]; cin>>n; while(n--)cin>>num[i++]; for(l=0;l=0;k--) if(d[k]=mid;k--) if(d[k]>=num[j])break; d[k+1]=num[j]; if 阅读全文
posted @ 2013-08-13 20:35 龙城星 阅读(120) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 下一页