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

水题不解释~~

Posted by 222888 at 2011-11-22 20:48:43 on Problem 3006
#include<stdio.h>
#include<math.h>
int sushu(int n)
{
	int i;
	if(n==1)
		return 0;
	if(n==2)
		return 1;
	for(i=2;i<=sqrt(n);i++)
		if(n%i==0)
			return 0;
		if(i>sqrt(n))
			return 1;
}
main()
{
	int sushu(int n);
	long a;
	int d,n,temp;
	while(1)
	{	
		temp=0;
		scanf("%d%d%d",&a,&d,&n);
		if(a==0&&d==0&&n==0)
			return;
		while(1)
		{			
			if(sushu(a))
				temp++;		
			if(temp==n)
			{
				printf("%ld\n",a);
				break;
			}
			a=a+d;
		}
	}
}


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