| ||||||||||
| 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 | |||||||||
为什么被判为Runtime Error呢//package untitled;
import java.util.Random;
import java.math.*;
import java.io.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class Main {
public static BigInteger split(BigInteger n) {
BigInteger i=new BigInteger("2");
while(true) {
if (n.mod(i).equals(new BigInteger("0"))) return i;
else
i.add(new BigInteger("1"));
}
}
public static void main (String[] args) throws Exception
{
int t=0;
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
t = Integer.parseInt(br.readLine());
}catch(IOException e) {}
for (int i=0; i<t; i++) {
String s = "";
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
s = br.readLine();
}catch(IOException e){}
BigInteger n = new BigInteger(s);
if (n.isProbablePrime(10)) {
System.out.println("Prime");
}
else {
System.out.println(split(n));
}
}
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator