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 |
跪求cow man帮忙看看,java版的,但是RE了..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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator