Given two positive integers a and n not exceeding 9, the function fn (a, n) is required to find the sum of a + aa + aaa ++ ⋯ + aa ⋯ aa (n a), and fn must return the sum of the sequence
Function interface definition:
fn(a,n)
其中 a 和 n 都是用户传入的参数。 a 的值在[1, 9]范围;n 是[1, 9]区间内的个位数。函数须返回级数和
Sample referee test procedure:
/* 请在这里填写答案 */
a,b=input().split()
s=fn(int(a),int(b))
print(s)
Sample input:
Here is a set of inputs. E.g:
2 3
Sample output:
The corresponding output is given here. E.g:
246
1 # using a special string function evaluation and the number of columns
2 # the Author: cnRick
. 3 # Time: 2020-4-10
. 4 DEF Fn (a, n-):
. 5 Result = 0
. 6 str_a = STR (a)
. 7 for I in Range ( 1, n + 1 ):
8 result = result + int (str_a * i)
9 return result