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 voager at 2011-07-01 10:42:33 on Problem 3006
#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:
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