05 2011 档案

摘要:昨天省赛结束,第一次参加省赛,虽然拿了二等奖,对于一个第一次参加省赛的人来说,应该是很不错的成绩了,但我始终没能高兴起来,内心里也没了那股兴奋劲,有的只是平静,不知道是因为这只是努力的结果还是感觉肩上的担子更重了些. 省赛对我们一年的努力给出了肯定,也给出了我们对ACM认识的重新定位,以及我们的学习习惯和思维方式的重新思考。一直把努力放在第一位,也被那样的道理所困惑着,努力不一定成功,但不努力一定不会成功。 是啊,很浅显的道理。这句话本身没有错,只是理解这句话的人的错了。虽然此时我还具体说不明白,但那种感觉从比赛结束到现在一直在浮现。看着自己做过的一道道题目,翻着一沓沓的资料,看着那些自己记下 阅读全文
posted @ 2011-05-29 21:37 聊聊IT那些事 阅读(456) 评论(3) 推荐(0) 编辑
摘要:View Code #include<iostream>char ch[51][51];using namespace std;int main(){ int t; int n , m , k=0 ; int i,j; cin>>t; while(t--) { cin>>n>>m; for(i=0;i<n; i++) cin>>ch[i]; int j , i , sign = 0 ; int ans=0; for( i = 0 ; i < n ; i++ ) { for( j = 0 ; j < m ; j++ ) 阅读全文
posted @ 2011-05-22 20:52 聊聊IT那些事 阅读(617) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1874View Code #include<iostream>#define _max 9999999#define M 201using namespace std;int map[M][M];int visit[M];int dir[M];int n , m ;int a , b , c ;int len;void Init(int n){ int i,j; for(i = 0 ; i <n ; i++) { for(j=0 ; j <n; j++) map[i][j] = _ma 阅读全文
posted @ 2011-05-20 21:15 聊聊IT那些事 阅读(879) 评论(0) 推荐(0) 编辑
摘要:View Code #include<iostream>#include<cstring>using namespace std;typedef long long ll;int p[100001] , tem[100001] ,t;void Init(){ memset(p,0,sizeof(p)); for(ll i=2; i<=100000; i++) { if( !p[i] ) { for( ll j = 2 ; j*i<=100000 ; j++ ) p[j*i]=1; } } t=0; for(int i=2;i<1000000;i++) 阅读全文
posted @ 2011-05-20 17:41 聊聊IT那些事 阅读(270) 评论(0) 推荐(0) 编辑
摘要:View Code #include<iostream>using namespace std;char a[1001] ;char x_a[1001] , y_b[1001] ;char xx[1001] , yy[1001];char x1[1001] , y1[1001];int Lx , Ly ;int sum[1001] ;int num ;int sign=0;int mark_x , mark_y ;int x[1001],y[1001];void Init_A() //将字符转化为数字{ int i; for ( i = 0 ; i < Lx ; i++ ) 阅读全文
posted @ 2011-05-18 16:26 聊聊IT那些事 阅读(642) 评论(0) 推荐(0) 编辑
摘要:View Code #include<iostream>usingnamespace std;char ch[101];int mark=0 , cnt; int len;void dfs(int x , int y , int i ){ if( x < y ) { return ; } if( y == x && i == len ) { cnt++; } if(ch[i]=='?') { dfs(x+1 , y , i +1 ); dfs(x, y +1 , i +1 ); } ... 阅读全文
posted @ 2011-05-17 20:28 聊聊IT那些事 阅读(568) 评论(2) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2087View Code #include<iostream>using namespace std;int main(){ char a[1001],b[1001]; int i,j; while(cin>>a) { if(a[0]=='#') break; cin>>b; int L1=strlen(a); int L2=strlen(b); int sign=0 , flag=0; i=sign,j=0; while(i<L1) { if(a[i 阅读全文
posted @ 2011-05-16 21:04 聊聊IT那些事 阅读(507) 评论(0) 推荐(0) 编辑
摘要:View Code /*Poj2406题解:if(len%(len-next[len])==0),则重复子串的长度为 len-next[len].证明如下,next[len]表示到len为止,满足既是前缀子串又是后缀子串的最长长度,如下图{a,c} = {b,d}若len%(len – next[len])==0,则说明{ a ,b} 的长度可以被{a, d} 的长度整除,同样可以被{b,c}的长度整除。而此时,由于{b,c}是{b,d}的前缀子串又是后缀子串且保持{a,b}的长度可以被{a,c}整除。这样,{a,c}就相当于原来的{a,d},而{b,c}就相当于原来的{b,d},通过这样的划 阅读全文
posted @ 2011-05-16 20:10 聊聊IT那些事 阅读(643) 评论(0) 推荐(0) 编辑
摘要:http://poj.org/problem?id=2752View Code //寻找前子串与后子串相等的子串#include<iostream>using namespace std;char ch[400001];int next[400001];int ans[400001];void solve (char *s, int ls){ int i=0,j=-1; next[0] = -1; while(i<ls) { if(j==-1 || s[i]==s[j]) { i++; j++; next[i] = j; } else { j = next[j]; } }}i 阅读全文
posted @ 2011-05-16 20:08 聊聊IT那些事 阅读(191) 评论(0) 推荐(0) 编辑
摘要:字符串查找Time Limit:1000MS Memory Limit:65536KTotal Submit:73 Accepted:24 Description 请编制程序实现下面的功能:统计一个子字符串在另一个字符串中出现的次数。Input 有多组数据,每组两行,两行输入的都是字符串。 字符串中字符没有限制,如第一行第一个字符是#时表示输入结束。Output 每组只输出一个整数,其单独成行,该整数代表第二个字符串在第一个字符串中出现的次数。Sample Input asd asasdfg asd as zx67 asd mkloas#Sample Output 6Hint 输入数据的格式是 阅读全文
posted @ 2011-05-15 20:54 聊聊IT那些事 阅读(292) 评论(0) 推荐(0) 编辑
摘要:连通图Time Limit:1000MS Memory Limit:65536KTotal Submit:17 Accepted:4 Description Input 输入:每组数据的第一行是两个整数n 和m(0 < n <=100)。n 表示图的顶点 数目,0 < m <= 100 表示图中边的数目。如果n 为 0 表示输入结束。随后有m 行数据,每 行有两个值x 和y(0 < x , y <=n ),表示顶点x 和y 相连,顶点的编号从1 开始计 算。输入不保证这些边是否重复。 Output 输出:对于每组输入数据,如果所有从1~n所有顶点都是连通的, 阅读全文
posted @ 2011-05-15 19:41 聊聊IT那些事 阅读(815) 评论(0) 推荐(0) 编辑
摘要:都是基础知识!http://acm.hdu.edu.cn/showproblem.php?pid=2057看了一位dn的解释,借鉴了:http://hi.baidu.com/gminking/blog/item/691ee158d213754dfbf2c016.html/cmtid/881e0f308ee322345bb5f5a4题目求的是十六进制的加法。刚开始想的是把十六进制转化为十进制,进行加法运算后,再转化为十六进制。后来发现自己忘了C中存在十六进制的输入输出(%X,%x)。所以这题可以直接用十六进制输入,然后进行十六进制的运算(其实不管是什么进制,在计算机中都是以二进制来计算的,只是按 阅读全文
posted @ 2011-05-13 21:05 聊聊IT那些事 阅读(1203) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3790View Code #include<iostream>#define M 1001#define Max 0x7fffffffusing namespace std;int n,m;int a,b,d,p;int s,t;int map[M][M];int cost[M][M];int de[M];int co[M];int visit[M];int len;int _min;void Init(){ int i,j; for(i=0;i<=n;i++) { for(j=0;j< 阅读全文
posted @ 2011-05-13 19:46 聊聊IT那些事 阅读(649) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/vcontest/vtl/problem/showproblem/vtlid/1816/problemid/1005View Code #include"iostream"using namespace std;int main(){ int t; int n,i; int x[101],y[101]; cin>>t; while(t--) { double sum=0; cin>>n; for(i=0;i<n;i++) cin>>x[i]>>y[i]; for(i=1;i&l 阅读全文
posted @ 2011-05-11 21:48 聊聊IT那些事 阅读(289) 评论(0) 推荐(0) 编辑
摘要:View Code #include"iostream"using namespace std;int k=0;void hanoi(int m , char a ,char b, char c){ if(m==1) { k++; printf("%c->%c ",a , c); return; } hanoi(m-1, a, c , b); printf("%c->%c ",a , c); k++; hanoi(m-1 , b, a, c);}int main(){ int n; char x,y,z; while(ci 阅读全文
posted @ 2011-05-10 20:25 聊聊IT那些事 阅读(169) 评论(0) 推荐(0) 编辑
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2553Nqueen问题#include"iostream"using namespace std;int n;int a[20];int b[20];int c;bool Panduan(int x){ for(int i=0; i<x; i++) { if( (a[x]-a[i])==0 || (abs(a[x]-a[i])-abs(x-i))==0 ) return false; //关键点 } return true;}void dfs(int y ,int z){ for(i 阅读全文
posted @ 2011-05-10 20:05 聊聊IT那些事 阅读(425) 评论(0) 推荐(0) 编辑
摘要: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那些事 阅读(328) 评论(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那些事 阅读(200) 评论(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那些事 阅读(299) 评论(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那些事 阅读(417) 评论(0) 推荐(0) 编辑
摘要:好久没写总结了,问题积累了不少,把做过的题型分类总结一下了,下面这些题型也是我在hdu acm step里面碰到的类型题,重新梳理一下思路。题型一:http://acm.hdu.edu.cn/showproblem.php?pid=1003hdu1003思路前段时间已经叙述过了,在这里重点说一下这种题型的入手点,一看这种题型就是属于求最大子序列的和,切入点就是找到start和end,即起始位置以及结束位置。起初,我碰到这道题的时候,也是借鉴网上的一些办法,不过随着学习的不断深入,也逐渐有了点头绪,其实思路还是和网上的基本一致,但这只是借鉴和学习,并没有真正做到融会贯通,这还需要时间吧。希望在. 阅读全文
posted @ 2011-05-04 20:55 聊聊IT那些事 阅读(452) 评论(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那些事 阅读(649) 评论(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那些事 阅读(466) 评论(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那些事 阅读(344) 评论(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那些事 阅读(266) 评论(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那些事 阅读(290) 评论(1) 推荐(0) 编辑
摘要:http://acm.fzu.edu.cn/problem.php?pid=2024View Code #include<stdio.h>#include<string.h>#define M 1010int c[M][M];int f[M][M];int min(int a,int b,int c){ int z=(a<b)?a:b; if(z<c)return z; else return c;}int Max(int a ,int b){return a>b?a:b;}void LCS(char aa[], char bb[], int x, i 阅读全文
posted @ 2011-05-02 09:15 聊聊IT那些事 阅读(217) 评论(0) 推荐(0) 编辑
摘要:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3501View Code #include<iostream>#include<algorithm>#include<string.h>#include<cstdio>using namespace std;char a[][15]={"0", "I", "II", "III", "IV", "V", &q 阅读全文
posted @ 2011-05-01 17:22 聊聊IT那些事 阅读(382) 评论(1) 推荐(0) 编辑

点击右上角即可分享
微信分享提示