var
a, n, i, j: Integer;
s: Int64;
begin
Readln(a, n);
s := 0;
if (a <= 9) and (n <= 14) and (n >= 1) then
begin
j := a;
s := j;
for i := 2 to n do
begin
j := j * 10 + a;
Inc(s, j);
end;
end;
Writeln(s);
Readln;
end.
可以用数学公式直接表达为:
s=a*(10^(n+1)-9*n-10)/81;