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

为什么被判为Runtime Error呢

Posted by mkss at 2004-08-31 15:58:19 on Problem 1811
//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:
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