Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么我加stdio.h就总是WA,而我把stdio.h去掉就马上可以通过了,这么奇怪的?!

Posted by 467093941984 at 2008-02-09 16:37:41 on Problem 1316 and last updated at 2008-02-10 05:47:54
#define SIZE 10000
#define TRUE 0
#define FALSE 1

int main() {
	unsigned char self_num[SIZE];
	int n, i, sum;

	for (n = 0; n <SIZE; n++) {
		self_num[n] = TRUE;
	}

	for (n = 1; n < SIZE; n++) {
		if (self_num[n] == TRUE) {
			i = n;
			while (i < SIZE) {
				sum = i;
				sum += i % 10;
				i /= 10;
				sum += i % 10;
				i /= 10;
				sum += i % 10;
				i /= 10;
				sum += i % 10;
				if (sum < SIZE) {
					self_num[sum] = FALSE;
				}
				i = sum;
			}
		}
	}

	for (n = 1; n < SIZE; n++) {
		if (self_num[n] == TRUE) {
			printf("%d\n", n);
		}
	}

	return 0;
}

我的代码如上,我是使用负逻辑进行运算的,是不是我的define出现了问题?

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator