不难,结果: 程序: import java.math.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); while(cin.hasNext()) { Integer n; n = cin.nextInt(); long a[] = new long [1005]; BigInteger b[] = ne…