| ||||||||||
| 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 | |||||||||
1 1 1要输出2In Reply To:Re:这题sample的数据挺全了。。 Posted by:jackie_wyx at 2006-11-27 20:46:08 > 可是我的都过了啊
> 可是还是WA
> #include <stdio.h>
>
> int c[10000000]={0};
>
> main()
> {
> int a,d,n,i,j,k;
>
> for(i=2;i<=1000000;i++)
> {
> if(c[i]==0)
> {
> for(j=i*2;j<=1000000;j=j+i) c[j]=1;
> }
> }
> scanf("%d%d%d",&a,&d,&n);
> while(a!=0 || d!=0 || n!=0)
> {
> k=0;
> j=-1;
> while(k<n)
> {
> j++;
> if(c[a+j*d]==0) k++;
> }
> printf("%d\n",a+j*d);
> scanf("%d%d%d",&a,&d,&n);
> }
>
> return(0);
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator