编程题38:
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int A = scanner.nextInt();
int N = scanner.nextInt();
BigInteger sum = BigInteger.ZERO;
BigInteger term = BigInteger.ZERO;
for (int i = 0; i < N; i++) {
term = term.multiply(BigInteger.TEN).add(BigInteger.valueOf(A));
sum = sum.add(term);
}
System.out.println(sum);
}
}

posted on 2025-06-04 22:48  Swishy  阅读(7)  评论(0)    收藏  举报