~/algor $ cat problems/for-darajalar-yigindisi
Sum of powers
Medium
1000 ms
64 MB
44%
Positive integers $N$ and $k$ are given. Compute the sum:
$$S = 1^{k} + 2^{k} + 3^{k} + \dots + N^{k}$$
Input
One line with two positive integers: $N$ and $k$.
Output
One integer — the sum.
Note
$1 \le N \le 20$
$1 \le k \le 10$
Examples
Input #1
3 2
Output #1
14
Input #2
4 3
Output #2
100