2012年4月21日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1231最大连续子序列,水View Code #include <stdio.h>#include <stdlib.h>int cmp(const void*a,const void*b){ return *(int*)b-*(int*)a;}int a[110000];int main(){ int n,i; int max,now; int start,end; int temp; int p,q; while(scanf("%d",&n),n) { .. 阅读全文
posted @ 2012-04-21 20:17 LegendaryAC 阅读(165) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2571dp。wa两次,设边从1开始,所以和0有关的除了ans[1][0]和ans[0][1]外都要初始化为无穷(不让从外面进来)View Code #include <stdio.h>int map[30][1100];int ans[30][1100];#define INF -100000000int max(int a,int b){ return a>b?a:b;}int main(){ int n,m; int t; int i,j,k; scanf("%d", 阅读全文
posted @ 2012-04-21 20:05 LegendaryAC 阅读(154) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4224。。。对这题目无语了,本来是秒杀的题目就是让你读不懂。。。View Code #include <stdio.h>#include <string.h>#include <stdlib.h>int main(){ int x1,y1,x2,y2,x3,y3; int t,nCase=1; scanf("%d",&t); while(t--) { scanf("%d%d%d%d%d%d",&x1,&y1,& 阅读全文
posted @ 2012-04-21 16:53 LegendaryAC 阅读(329) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4147小学生英文阅读题View Code #include <stdio.h>#include <string.h>#include <stdlib.h>#define INF 100000000int main(){ int n,B,D,f,F; int sum,min,len; int i,j; char s[1100]; while(~scanf("%d%d%d%d%d%*c",&n,&B,&D,&f,&F) 阅读全文
posted @ 2012-04-21 16:25 LegendaryAC 阅读(252) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4148找规律,后一项描述前一项每一段有多少连续的相同数字。ps:算到30项,总共的长度也不小了,开始s数组开小了,一直运行出错,郁闷好一会View Code #include <stdio.h>#include <string.h>#include <stdlib.h>char s[40][11000];int main(){ int n,i,j; int cnt,f; s[1][0]='1'; s[1][1]='\0'; for(i=2;i 阅读全文
posted @ 2012-04-21 15:44 LegendaryAC 阅读(277) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1326水,不过PE两次,囧View Code #include <stdio.h>#include <stdlib.h>int cmp(const void*a,const void*b){ return *(int*)b-*(int*)a;}int main(){ int n,i,s,av,bz; int h[60]; int nCase=1; while(scanf("%d",&n),n) { s=bz=0; for(i=0;i<n;i++)... 阅读全文
posted @ 2012-04-21 14:26 LegendaryAC 阅读(233) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1289对二进制数进行位运算。首先可以百度一下IEEE 754的规则。以6560.91为例:6560.91的二进制表示为1100110100000.111010001111010111,写成科学计数法就是1.100110100000111010001111010111 * 2^12s有一位,是符号位,为正数,符号位是0。e有八位,代表二进制数的指数,这时e就是12(sample输出的第一个数)。f代表有效部分,有23位,为100110100000111010001111010111 。所以,符号位是0然后用它的 阅读全文
posted @ 2012-04-21 14:03 LegendaryAC 阅读(209) 评论(0) 推荐(0) 编辑
 
摘要: http://icpc.ahu.edu.cn/OJ/Problem.aspx?id=501和hdu1024一模一样,随便改改就过了。。。ps:安徽大学oj这个经验值系统真好玩、、View Code #include <stdio.h>#include <string.h>#include <stdlib.h>#define INF -100000000int max(int a,int b){ return a>b?a:b;}int a[1100000],p[1100000],q[1100000],now[1100000],pro[1100000];/ 阅读全文
posted @ 2012-04-21 00:13 LegendaryAC 阅读(205) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1024求m个子段的最大和。思路见代码注释。View Code #include <stdio.h>#include <string.h>#include <stdlib.h>#define INF -100000000int max(int a,int b){ return a>b?a:b;}int a[1100000],now[1100000],pro[1100000];//now记录当前最大值,pro记录前一个的最大值 int main(){ int n,m,i, 阅读全文
posted @ 2012-04-21 00:05 LegendaryAC 阅读(207) 评论(0) 推荐(0) 编辑