symons

___________每一天都是幸福的!!

  博客园  ::  :: 新随笔  ::  :: 订阅 订阅  :: 管理
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 22 下一页

2013年12月23日

摘要: 这题目写了一上午,一直错,然后自己测试数据还都对。为什么呢,为什么呢,后来我才发现代码里有一行free(tmp)。。。在55行那里。。。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define mod 999983 7 using namespace std; 8 struct node{ 9 int num[6];10 node *next;11 }p[mod];12 int sign[mod];13 int cmp_1(node *a,node *b,int pos){14 int ... 阅读全文
posted @ 2013-12-23 14:49 symons 阅读(207) 评论(0) 推荐(0)

摘要: 这题终于让我AC了,其过程之艰辛我不想再回忆了,看了各种代码,一定要注意指针空和非空的问题,再一个要注意边界。 1 #include 2 #include 3 #include 4 #include 5 #define mod 9967 6 int gird[100000+100][32]; 7 int K; 8 int cmp(int a,int b){ 9 int i;10 for(i=0;inext=NULL;66 tmp->pos=i;67 int ss=0;68 ... 阅读全文
posted @ 2013-12-23 03:04 symons 阅读(185) 评论(0) 推荐(0)

2013年12月18日

摘要: a 阅读全文
posted @ 2013-12-18 20:30 symons 阅读(133) 评论(0) 推荐(0)

摘要: #include #include #include #include #include #include int main(){ int fd; struct tm *now; char haha[50]; time_t res; int cnt; fd=open("d:/log_info.txt",O_WRONLY|O_APPEND|O_CREAT); res=time(NULL); now=localtime(&res); printf("start time is: %s\n",asctime(now)); strcpy(ha... 阅读全文
posted @ 2013-12-18 19:52 symons 阅读(160) 评论(0) 推荐(0)

2013年12月1日

摘要: 转自http://www.cnblogs.com/duzouzhe/archive/2009/10/14/1583359.html暴雪公司有个经典的字符串的hash公式 先提一个简单的问题,假如有一个庞大的字符串数组,然后给你一个单独的字符串,让你从这个数组中查找是否有这个字符串并找到它,你会怎么做? 有一个方法最简单,老老实实从头查到尾,一个一个比较,直到找到为止,我想只要学过程序设计的人都能把这样一个程序作出来,但要是有程序员把这样的程序交给用户,我只能用无语来评价,或许它真的能工作,但也只能如此了。 最合适的算法自然是使用HashTable(哈希表),先介绍介绍其中的基本知识,所谓Has 阅读全文
posted @ 2013-12-01 01:12 symons 阅读(196) 评论(0) 推荐(0)

2013年11月24日

摘要: #include #include #include int main(){ int dp[200]; int count[200]; int n,m,k,s; int c[200],w[200]; int i,j,res; while(~scanf("%d%d%d%d",&n,&m,&k,&s)){ for(i=1;i=dp[j-c[i]]+w[i]){ dp[j]=dp[j]; count[j]=count[j]; }else{ ... 阅读全文
posted @ 2013-11-24 17:04 symons 阅读(180) 评论(0) 推荐(0)

摘要: #include #include #define mmin(x,y) (x)=c[i];--v){ dp[v]=mmin(dp[v],dp[v-c[i]]*w[i]); } } res=1; for(i=n;i>=0;--i){ if(dp[i]>=aim){ if(dp[i]<res) res=dp[i]; } } printf("%.1lf%%\n... 阅读全文
posted @ 2013-11-24 15:13 symons 阅读(150) 评论(0) 推荐(0)

摘要: f(x,t)=max{ f(x-1,t-1) , f(x,t-1) , f(x+1,t-1) };left=(5-t)>0?(5-t):0;right=(5+t)#include #define mmax(x,y,z) (x)>((y)>(z)?(y):(z))?(x):((y)>(z)?(y):(z))int gird[100000+10][11];int main(){ int i,j; int n,x,t; int left,right; int maxt; int res; int x1,x2,x3; while(~scanf("%d",&a 阅读全文
posted @ 2013-11-24 14:32 symons 阅读(181) 评论(0) 推荐(0)

摘要: #include #include #define MAXN 1100int parent[MAXN];int n,m;void UFset(){ for(int i=1;i=0;s=parent[s]) ; while(s!=x){ int tmp=parent[x]; parent[x]=s; x=tmp; } return s;}void Union(int R1,int R2){ int r1=Find(R1),r2=Find(R2); int tmp=parent[r1]+paren... 阅读全文
posted @ 2013-11-24 12:48 symons 阅读(349) 评论(0) 推荐(0)

2013年11月19日

摘要: use fmax().-------TLE#define mmax(a,b) (a)>(b)?(a):(b); ---796msthat's it!#include #include #include #define mmax(a,b) (a)>(b)?(a):(b);int main(){ int dp[50*50*100+100]; int n,t,i,j,res; int w[250000+10]; int t1,t2; int cnt,sum; while(~scanf("%d",&n)){ if(n=w[i];--j) ... 阅读全文
posted @ 2013-11-19 13:06 symons 阅读(249) 评论(0) 推荐(0)

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 22 下一页