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

1000?

Posted by sunmoonstar at 2006-12-08 14:35:01 on Problem 2262
In Reply To:run time error???!!! Posted by:200630740629 at 2006-12-08 13:59:42
> 该有的都有喇,有谁知道为啥会RUNTIME ERROR?发生什么事了?
> 
> 
> 
> 
> 
> include <stdio.h>
> #include <math.h>
> 
> int check(long n)
> {
>  int i;
>  for(i=2;i<=sqrt(n);i++)
>  {
>   if(n%i==0) return 0;
>  }
>  return 1;
> }
> 
> long pri(long get)
> {
>  int i;
>  for(i=3;i<=get/2;i++)
>  {
>   if(check(get-i)==1) 
> 	{if(check(i)==1) return i;}
>  }
> }
> 
> void main()
> {
>  long pri(long get);
>  long get[1000],i=0,n;
>  int a,b;
>  for(n=0;;n++)
>  {
>   scanf("%ld",&get[n]);
>   if(get[n]==0) break;
>  }
>  for(;n>0;n--)
>  {
>   
>   printf("%ld=%ld+%ld\n",get[i],pri(get[i]),get[i]-pri(get[i]));
>   i++;
>  }
> }

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