| ||||||||||
| 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 | |||||||||
run time error???!!!该有的都有喇,有谁知道为啥会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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator