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

这样用java,为什么会runtime error?

Posted by greatshark at 2009-10-15 12:53:12 on Problem 1811
import java.util.*;
import java.math.*;

public class Main
{
    public static void main(String[] argu)
    {
        Scanner scan=new Scanner(System.in);
        int t;
        BigInteger n,i,two=new BigInteger("2");
        
        t=scan.nextInt();
        while(t-->0)
        {
            n=scan.nextBigInteger();
            if(n.isProbablePrime(10))
                System.out.println("Prime");
            else
            {
                for(i=two;n.mod(i).equals(BigInteger.ZERO)==false;i=i.add(BigInteger.ONE));
                System.out.println(i);
            }
        }
    }
}

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