摘要: 这里主要预习了素数筛选以及输入外挂的编写。涛神的筛选法一直记着,给力。 #include <cstdio>#include <cstring>#include <cstdlib>using namespace std;char hash[16005] = {0};bool getint( int &t ){ char c; int f = 1; while( c = getchar(), c != '-' && ( c < '0' || c > '9' ) ) { if( c 阅读全文
posted @ 2011-08-29 21:22 沐阳 阅读(290) 评论(0) 推荐(0) 编辑
摘要: Calculate the formulaTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3836Accepted Submission(s): 1126Problem DescriptionYou just need to calculate the sum of the formula: 1^2+3^2+5^2+……+ n ^2.InputIn each case, there is an odd positive integer n.Ou 阅读全文
posted @ 2011-08-29 20:19 沐阳 阅读(534) 评论(0) 推荐(0) 编辑
摘要: 模拟题。 代码如下:#include <cstdio>#include <cstring>#include <cstdlib>using namespace std;char q[2000];int main(){ while( gets( q ) ) { char * t, *p; int len = strlen( q ); t = q; while ( 1 ) { if( p = strchr( t, '?' ) ) { ... 阅读全文
posted @ 2011-08-29 15:07 沐阳 阅读(208) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3257 刚开始没有弄明白哪些十六进制数的意义,后来才恍然大悟,原来就是一个七行有无 '#' 二进制的表示,知道了这个后就比较简单了。 代码如下: 1 #include <cstring> 2 #include <cstdlib> 3 #include <cstdio> 4 using namespace std; 5 6 int num[85][10], base[10]; 7 8 int main() 9 {10 for( int i = 0; i < 阅读全文
posted @ 2011-08-29 13:38 沐阳 阅读(346) 评论(0) 推荐(0) 编辑
摘要: I Love You TooTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 865Accepted Submission(s): 531Problem DescriptionThis is atrue story. A man showed his love to a girl,but the girl didn't replied clearly ,just gave him a Morse Code:****-/*----/---- 阅读全文
posted @ 2011-08-29 12:49 沐阳 阅读(462) 评论(0) 推荐(0) 编辑
摘要: 亲和串Time Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2427Accepted Submission(s): 1080Problem Description人随着岁数的增长是越大越聪明还是越大越笨,这是一个值得全世界科学家思考的问题,同样的问题Eddy也一直在思考,因为他在很小的时候就知道亲和串如何判断了,但是发现,现在长大了却不知道怎么去判断亲和串了,于是他只好又再一次来请教聪明且乐于助人的你来解决这个问题。亲和串的定义是这样的:给定两个.. 阅读全文
posted @ 2011-08-29 01:38 沐阳 阅读(634) 评论(0) 推荐(0) 编辑
摘要: 由于该题是求一个数是不是“自身数”,而定义一个数是不是“自身数”的根据就是是否有祖先,又因为一个数的祖先一定比这个数要小,所以这就和筛选法很像了。 代码如下: 1 #include <cstring> 2 #include <cstdlib> 3 #include <cstdio> 4 using namespace std; 5 6 char hash[1000005]; 7 8 void deal( int x ) 9 {10 int rec = x;11 while( x > 0 )12 {13 int c = x % 10;14 ... 阅读全文
posted @ 2011-08-29 00:44 沐阳 阅读(821) 评论(0) 推荐(0) 编辑