摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1282水题。跟在创新工场遇到的一个问题类似,整数串判断回文。由于题目所称整数的限制,数组的大小不是太好取。参考网上的经验值。#include <stdio.h>#define MAX_ARRAY 100int ReserveNum(int a){ int ret = 0; while(a) { ret = ret *10 + a%10; a /=10; } return ret;}int main(){ int first,last; ... 阅读全文
posted @ 2012-03-17 17:40 westfly 阅读(299) 评论(0) 推荐(0) 编辑
摘要: 水题http://acm.hdu.edu.cn/showproblem.php?pid=3787关键点:1)整数范围表示所需要的字符串长度。2)字符串转化为整数的函数。看代码#include <stdio.h>#define MAX_ARRAY 16int StringToNum(char *str);int main(){ char Aarray[MAX_ARRAY],Barray[MAX_ARRAY]; while(scanf("%s%s",Aarray,Barray)!= EOF) { //printf("%s\t%s\n",Aarra 阅读全文
posted @ 2012-03-17 15:02 westfly 阅读(290) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1235刚开始没有注意题目。效率不高。数组直接开到N了。View Code #include <stdio.h>#define MAX_ARRAY 1000int main(){ int scores[MAX_ARRAY]; int nTotal; int focus; int i; while(scanf("%d",&nTotal) &&nTotal) { for(i = 0; i < nTotal; ++i) { ... 阅读全文
posted @ 2012-03-17 10:24 westfly 阅读(202) 评论(0) 推荐(0) 编辑