| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
水题不解释~~#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator