AKOJ正在加载中...

6660: MiaoWu's Function

金币值:2 定数:1 时间限制:1.000 s 内存限制:128 M
正确:1 提交:1 正确率:100.00% 命题人:
点赞量:0 收藏量:0 题目类型:程序

题目描述

Given n,k and the function f(n,k) = 1^k + 2^k + ... + n^k , you're supposed to calculate it.

输入格式

Multiple test cases.

Each line contains two numbers n,k(1<=n,k<=10^9)

输出格式

Output the last digit of the function f(n,k)

输入样例    复制

1 1
8 4
2 5
3 2
5 2
8 3
2 4

输出样例    复制

1
2
3
4
5
6
7