java水过…… 代码如下: import java.math.*; import java.util.*; public class Main { public static void main(String arg[]){ BigInteger n,ans,sum; Scanner cin = new Scanner(System.in); int k,t=cin.nextInt(); while(t-->0){ n=cin.nextBigInteger(); k=cin.nextInt()…