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

诸位大虾帮小弟看一下,谢谢,怎么RE了呢?

Posted by 46590208 at 2006-10-06 13:14:54 on Problem 1595
#include<stdio.h>


int main()
{
	int a,b;
	int m,number;
	int A[10000];
	int i,j;
	for(i=0;i<10000;i++)
		A[i]=-1;
	scanf("%d %d",&a,&b);
	int t,q,p=0;	
	for(t=1;t<=a;t+=2)
	{
		for(q=2;q<=t/2;q++)
		{
			if(t%q==0)           //i不是素数
				break;
		}
		if(q>t/2)
			A[p++]=t;
	}
	number=p-1;
	m=number/2;
	printf("%d %d:",a,b);
	if(b<=number)
	{
	if(number%2==1)
		for(j=m-(b-1);j<=m+(b-1);j++)
			printf("%d ",A[j]);
	else if(number%2==0)
		for(j=m-b;j<=m+b-1;j++)
			printf("%d ",A[j]);
	}
	else
		for(j=0;j<=number;j++)
			printf("%d ",A[j]);
	return 0;
}


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