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 |
所有的样数都通过了,为什么还是WA呢……呃……#include<stdio.h> int num[1000000]={1,1},prime[1000000]; void main() { int i,j=1,k,count=0,n; int a[100],b[100],c[100]; for(k=0;k<100;k++) { scanf("%d %d %d",&a[k],&b[k],&c[k]); if(a[k]==0&&b[k]==0&&c[k]==0) break; } for(i=2;i<1000;i++) if(num[i]==0) for(j=i*2;j<1000000;j+=i) num[j]=1; for(i=0,j=0;i<1000000;i++) if(num[i]!=1) prime[j++]=i; for(n=0;n<k;n++) { for(i=0;;i++) if((prime[i]-a[n])>=0) break; for(count=0;i<1000000;i++) if((prime[i]-a[n])%b[n]==0&&prime[i]!=0) { count++; if(count==c[n]) { printf("%d\n",prime[i]); break; } } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator