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

可是我的超时了,求指导

Posted by 912106840442 at 2013-12-27 21:52:43 on Problem 2551
In Reply To:Re:Java大数1157MS,居然也过了 Posted by:912106840442 at 2013-12-27 21:52:05
import java.util.Scanner;
import java.math.BigInteger;
public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		while(in.hasNext()){
			int n=in.nextInt();
			int count=1;
			BigInteger N=BigInteger.valueOf(n);
			String mul="1";
			BigInteger bigmul=new BigInteger(mul);
			while(bigmul.remainder(N)!=BigInteger.ZERO){
				mul+="1";
				bigmul=new BigInteger(mul);
				count++;
			}
			System.out.println(count);
		}
	}
}

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