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<iostream> #include<math.h> using namespace std; bool is_prime(unsigned n){ if(n<2) return false; if(n==2||n==3|n==5||n==7) return true; for(int i=2;i<sqrt(n);i++) if(n%i==0) return false; return true; } int main(){ int a,d,m,n,i; scanf("%d%d%d",&a,&d,&n); if(a==0&&d==0&&n==0){ return 0; } for(i=0;;i++){ int j=0; m=a+d*i; if(is_prime==0) continue; j++; if(j==n) break; } cout<<m<<endl; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator