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 |
可是我的超时了,求指导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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator