Easy Summation
Description
Given two integers $n$ and $k$. Let $f(i)=i^k$, please evaluate the sum $f(1)+f(2)+...+f(n)$. The problem is simple as it looks, apart from the value of $n$ in this question is quite large.
Can you figure the answer out? Since the answer may be too large, please output the answer modulo $10^9+7$.
Input
Each of the following $T$ lines contains two integers $n(1\leq n\leq 10000)$ and $k(0\leq k\leq 5)$.
Output
Sample Input
Sample Output
#include<stdio.h>
#define MAX 1000000007
#define ll long long int
ll test(int n,int k)
{
ll i,t;
t=;
for(i=; i<=k; i++)
{
t=(t*n)%MAX;
}
return t;
}
int main()
{
ll n,k,sum,i,t;
while(scanf("%lld",&t)!=EOF)
{
while(t--)
{
sum=;
scanf("%lld%lld",&n,&k);
for(i=; i<=n; i++)
{
sum=(sum+test(i,k))%MAX;
}
printf("%lld\n",sum);
}
}
return ;
}
Easy Summation的更多相关文章
- HDU6027 Easy Summation 2017-05-07 19:02 23人阅读 评论(0) 收藏
Easy Summation Time Limit: 2000/1000 MS ...
- hdu6027Easy Summation(快速幂取模)
Easy Summation Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) ...
- CUDA编程(十)使用Kahan's Summation Formula提高精度
CUDA编程(十) 使用Kahan's Summation Formula提高精度 上一次我们准备去并行一个矩阵乘法.然后我们在GPU上完毕了这个程序,当然是非常单纯的把任务分配给各个线程.也没有经过 ...
- 【转】Windows下使用libsvm中的grid.py和easy.py进行参数调优
libsvm中有进行参数调优的工具grid.py和easy.py可以使用,这些工具可以帮助我们选择更好的参数,减少自己参数选优带来的烦扰. 所需工具:libsvm.gnuplot 本机环境:Windo ...
- Struts2 easy UI插件
一.easy UI是类似于jQuery UI的插件库,它提供了丰富的各种常用插件:tree.datagrid... tree插件: 语法:$(selector).tree([settings]); 常 ...
- Easy UI常用插件使用
一.easy UI是类似于jQuery UI的插件库,它提供了丰富的各种常用插件:tree.datagrid... tree插件: 语法:$(selector).tree([settings]); 常 ...
- UVA-11991 Easy Problem from Rujia Liu?
Problem E Easy Problem from Rujia Liu? Though Rujia Liu usually sets hard problems for contests (for ...
- CodeForces462 A. Appleman and Easy Task
A. Appleman and Easy Task time limit per test 1 second memory limit per test 256 megabytes input sta ...
- easy ui插件
简介: easy UI是类似于jQuery UI的插件库 注意:多脚本同时使用时,注意脚本冲突问题. 常用插件: 1.tree插件(tree插件实现动态树形菜单) 2.datagrid插件(datag ...
随机推荐
- 浅谈HTML5中canvas中的beginPath()和closePath()的重要性
beginPath的作用很简单,就是开始一段新的路径,但在使用canvas绘图的过程中却非常重要 先来看一小段代码: var ctx=document.getElementById("can ...
- 启动pip时,< Fatal error in launcher: Unable to create process using '"' >问题的原因及解决方法
根本原因 要启动的pip程序,中指定的python程序路径不对 实例分析 我的window电脑上同时安装了python2.7和python3.6,他们的安装路径如下图: 注意图python2.7中红线 ...
- 一、PHP基础-安装PHP集成环境
目录 PHP运行集成环境下载 phpStudy集成环境安装 XAMPP集成环境安装 WampServer环境安装 作者:吴耀田 个人博客:http://www.cnblogs.com/isaacwy ...
- 泛型List集合转化为DateTable
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; name ...
- STM32 硬件UART接收超时检测设置
STM32 硬件UART接收超时检测设置 -----------------本文作者"智御电子",期待与电子爱好者交流学习.---------------- 应用场景 在uart应 ...
- UDP server Code
Code Example: The following programs demonstrate the use of getaddrinfo(), gai_strerror(), freeaddri ...
- python--基本类型之集合
set(集合): 定义和创建: 定义:集合是一个无序的,不重复的数据集合,它主要作用1:去重,把一个列表变成集合,就自动去重了2:关系测试,测试两组数据之间的交集,差集,并集等关系 集合:把不同的数据 ...
- C#使用API屏蔽系统热键和任务管理器
最近做的一个winform类型的项目中需要屏蔽系统热键,在网上搜索了一下,基本上都是调用api来进行hook操作,下面的代码就可以完成功能 using System; using System.IO; ...
- 佛山Uber优步司机奖励政策(12月14日到12月20日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...
- 2212: [Poi2011]Tree Rotations
2212: [Poi2011]Tree Rotations https://www.lydsy.com/JudgeOnline/problem.php?id=2212 分析: 线段树合并. 首先对每个 ...