题目
解析
- 利用BigInteger类型进行
代码
import java.util.*;
import java.math.BigInteger;
public class Main{
public static void main(String[]args){
Scanner sc = new Scanner(System.in);
String str = "1";
BigInteger s = new BigInteger(str);
BigInteger n = sc.nextBigInteger();
BigInteger s1;
int count = 1;
while(true){
if(s.remainder(n).intValue()==0){
s1 = s.divide(n);
break;
}
else{
str = str + "1";
s = new BigInteger(str);
count ++;
}
}
System.out.print(s1+" "+count);
}
}