上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 26 下一页
摘要: View Code #include"iostream"using namespace std;int a[1001],b[1001];int used[1001];int n;int i,j,q,t;void Init(){ for(i=1;i<40;i++) b[i]=1; for(i=2;i<40;i++) { for(j=2;j<40;j++) b[i*j]=0; }}void dfs(int x, int y){ if(y == n) { if( b[x+1] ) { a[n]=x; cout<<"1 "; for 阅读全文
posted @ 2011-05-10 16:29 聊聊IT那些事 阅读(324) 评论(0) 推荐(0) 编辑
摘要: View Code #include"iostream"#include"iostream"using namespace std;int n;int mark=0;char a[50] , b[50];int c[50] , d[50];int f[50] , e[50];int La, Lb;int marka, markb;int s,t;int i,j;int _max;int Max(int x, int y){ return x>y?x:y;}void Add(){ memset(e,0,sizeof(e)); int m=0,flag 阅读全文
posted @ 2011-05-09 16:38 聊聊IT那些事 阅读(196) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3787View Code #include"iostream"using namespace std;int main(){ char a[1001],b[1001]; int c[1001],d[1001]; int i; while(cin>>a>>b) { int L1=strlen(a); int L2=strlen(b); int start_a=1 , start_b=1; int s=0,t=0; for(i=0;i<L1;i++) if(a[i 阅读全文
posted @ 2011-05-08 21:22 聊聊IT那些事 阅读(294) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1753有时间优化一下,写的好长啊!View Code #include"iostream"using namespace std;int main(){ char a[1001],b[1001]; int c[1001] , d[1001]; int e[1001]; int i,j; while(cin>>a>>b) { int L1=strlen(a); int L2=strlen(b); int start_a=L1-1,start_b=L2-1; for(i 阅读全文
posted @ 2011-05-08 21:08 聊聊IT那些事 阅读(413) 评论(0) 推荐(0) 编辑
摘要: 好久没写总结了,问题积累了不少,把做过的题型分类总结一下了,下面这些题型也是我在hdu acm step里面碰到的类型题,重新梳理一下思路。题型一:http://acm.hdu.edu.cn/showproblem.php?pid=1003hdu1003思路前段时间已经叙述过了,在这里重点说一下这种题型的入手点,一看这种题型就是属于求最大子序列的和,切入点就是找到start和end,即起始位置以及结束位置。起初,我碰到这道题的时候,也是借鉴网上的一些办法,不过随着学习的不断深入,也逐渐有了点头绪,其实思路还是和网上的基本一致,但这只是借鉴和学习,并没有真正做到融会贯通,这还需要时间吧。希望在. 阅读全文
posted @ 2011-05-04 20:55 聊聊IT那些事 阅读(449) 评论(1) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2570也算细心题啊。View Code #include"iostream"#include"algorithm"using namespace std;int main(){ int i,t; int n,v,w; double a[110]; cin>>t; while(t--) { cin>>n>>v>>w; for(i=0;i<n;i++) cin>>a[i]; sort(a,a+n); doub 阅读全文
posted @ 2011-05-04 08:55 聊聊IT那些事 阅读(645) 评论(1) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1160dp问题:状态转移——>:a[i]=a[j]+1;b[i]=j; //记录找到最下降序列的路径, 即下标标号思路:先按照重量递增排序,如果w相等,则按照速度v的递减顺序排序,最后找出以速度为关键字的递减最大子序列即可。代码如下:View Code #include<iostream>#include<algorithm>using namespace std;int b[1001];int a[1001];int c[1001];struct node{ int w; in 阅读全文
posted @ 2011-05-03 16:45 聊聊IT那些事 阅读(457) 评论(1) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1159直接模板!View Code #include"iostream"using namespace std;char a[1001],b[1001];int c[1001][1001];int Max(int a, int b){ return a>b?a:b;}void LCS(char *aa , char *bb, int x, int y){ int i,j; for(i=0;i<=x;i++) c[i][0]=0; for(j=0;j<=y;j++) c[0 阅读全文
posted @ 2011-05-03 09:51 聊聊IT那些事 阅读(338) 评论(1) 推荐(0) 编辑
摘要: 就当是练习了(各种高精度)!综合很强!View Code #include"iostream"#define M 1010using namespace std;char ch1[M],ch2[M];int a[M],b[M];int c[M],d[M];int num[M];int sum[M];int W[M];int H[M];int t,k,g,v;int i,j;int La,Lb;int sign=0;int s;int L;void _ADD(){ La=0; W[La++]=(sum[L-1]+1)%10; int flag=(sum[L-1]+1)/10; 阅读全文
posted @ 2011-05-02 20:57 聊聊IT那些事 阅读(262) 评论(1) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1402我的代码,由于时间的问题,以后找机会优化了!(超时)View Code #include"iostream"#define M 100010using namespace std;char ch1[M],ch2[M];int a[M],b[M];int c[M],d[M];int num[M];int H[M];int t,k,g,v;int i,j;int La,Lb;int sign=0;void Add(int x ,int y){ sign=0; t=0; int p,q,f 阅读全文
posted @ 2011-05-02 17:35 聊聊IT那些事 阅读(287) 评论(1) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 26 下一页