上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 47 下一页

2012年4月21日

摘要: 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) 编辑

2012年4月20日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3752捅死一只萌萌~View Code #include <stdio.h>int main(){ int t,m,n,i; scanf("%d",&t); while(t--) { scanf("%d%d",&m,&n); for(i=0;i<n-1;i++) m-=2; puts(m%2?"NO":"YES"); } return 0;} 阅读全文
posted @ 2012-04-20 00:40 LegendaryAC 阅读(180) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2537模拟View Code #include <stdio.h>char a[100];int n;int gao(){ int r,y,i; r=y=7; for(i=0;i<n;i++) { if(a[i]=='R')r--; if(a[i]=='Y')y--; if(a[i]=='B'&&r==0)return 1; if(a[i]=='B'&&r!=0)return 0; if(a[i] 阅读全文
posted @ 2012-04-20 00:19 LegendaryAC 阅读(210) 评论(0) 推荐(0) 编辑

2012年4月19日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1106直接做不太方便,在网上新学一招。atoi这个函数原来做进制转换的时候就接触过。如果第一个非空格字符不存在或者不是数字也不是正负号则返回零,否则开始做类型转换,之后检测到非数字(包括结束符 \0) 字符时停止转换,返回整型数。(百度百科)简而言之是一个把字符型数字转化成整型的函数。strtok函数,感觉这个比较新鲜。下面从百度百科摘点介绍:原型 char *strtok(char *s, const char *delim);功能 分解字符串为一组字符串。s为要分解的字符串,delim为分隔符字符串。.. 阅读全文
posted @ 2012-04-19 22:26 LegendaryAC 阅读(1959) 评论(0) 推荐(1) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1013按要求模拟View Code #include <stdio.h>#include <string.h>int main(){ int n; char a[1100]; while(gets(a)) { if(a[0]=='0')break; int len=strlen(a); n=0; for(int i=0;i<len;i++) { n+=a[i]-'0'; n... 阅读全文
posted @ 2012-04-19 21:13 LegendaryAC 阅读(179) 评论(1) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1718求给定学号在所有人里面的排名View Code #include <stdio.h>int main(){ int gd; int a[1100],b[1100]; int i; while(~scanf("%d",&gd)) { int cnt=0; while(scanf("%d%d",a+cnt,b+cnt),(a[cnt]||b[cnt])) cnt++; for(i=0;i<cnt;i++) ... 阅读全文
posted @ 2012-04-19 17:12 LegendaryAC 阅读(201) 评论(0) 推荐(0) 编辑
上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 47 下一页