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

跪求cow man帮忙看看,java版的,但是RE了..

Posted by Ly86 at 2010-03-15 21:48:46 on Problem 2635
import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
public static void main(String args[]){
	Scanner cin = new Scanner(System.in);
    BigInteger a[] = new BigInteger[100010];
    BigInteger i = new BigInteger("2");
    BigInteger c1 = new BigInteger("100010");
    BigInteger c2 = new BigInteger("1");
    int n = 0,j;
    a[n++] = i;
    for(;i.compareTo(c1)<=0;i=i.add(c2))
    	if(i.isProbablePrime(10)) a[n++] = i;
   BigInteger x,y;
   boolean sign = false;
    while(true){
    	x = cin.nextBigInteger();
    	y = cin.nextBigInteger();
    	sign =false;
    	if(y.compareTo(BigInteger.ZERO)==0) break;
    	for(j=0;j<n&&a[j].compareTo(x)<=0&&a[j].compareTo(y)<=0;j++)
    		if(x.mod(a[j]).compareTo(BigInteger.ZERO)==0) {sign = true;break;}
         if(sign) System.out.println("BAD "+a[j]);
         else
        	 System.out.println("GOOD");
    }
    }
}


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