题解:http://bestcoder.hdu.edu.cn/blog/

 多校6  HDU5793 A Boring Question

 // #pragma comment(linker, "/STACK:102c000000,102c000000")
// #include <conio.h>
#include <bits/stdc++.h>
using namespace std;
#define clc(a,b) memset(a,b,sizeof(a))
const double inf = 0x3f3f3f3f;
#define lson l,mid,rt<<1
// #define rson mid+1,r,rt<<1|1
const int N = ;
const int MOD = 1e9+;
#define LL long long
#define LB long double
// #define mi() (l+r)>>1
double const pi = acos(-);
const double eps = 1e-;
void fre(){freopen("in.txt","r",stdin);}
void freout(){freopen("out.txt","w",stdout);}
inline int read(){int x=,f=;char ch=getchar();while(ch>''||ch<'') {if(ch=='-') f=-;ch=getchar();}while(ch>=''&&ch<='') { x=x*+ch-'';ch=getchar();}return x*f;} LL q_MOD(LL a,LL n)
{
LL ans=;
while(n){
if(n&)ans=ans*a%MOD;
n>>=;
a=a*a%MOD;
}
return ans;
}
int main()
{
int t;
scanf("%d",&t);
while(t--){
LL n,m;
scanf("%LLd%LLd",&n,&m);
printf("%LLd\n",(q_MOD(m,n+)-)*q_MOD(m-,MOD-)%MOD);
}
return ;
}

多校6 1001 HDU5793 A Boring Question (推公式 等比数列求和)的更多相关文章

  1. hdu-5793 A Boring Question(二项式定理)

    题目链接: A Boring Question Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java ...

  2. HDU 5793 A Boring Question (逆元+快速幂+费马小定理) ---2016杭电多校联合第六场

    A Boring Question Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others ...

  3. hdu 5793 A Boring Question(2016第六场多校)

    A Boring Question Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others ...

  4. 多校5 1001 HDU5781 ATM Mechine 记忆化搜索+概率

    // 多校5 1001 HDU5781 ATM Mechine // http://acm.hdu.edu.cn/search.php?field=problem&key=2016+Multi ...

  5. HDU 5793 - A Boring Question

    HDU 5793 - A Boring Question题意: 计算 ( ∑(0≤K1,K2...Km≤n )∏(1≤j<m) C[Kj, Kj+1]  ) % 1000000007=? (C[ ...

  6. hdu_5793_A Boring Question(打表找规律)

    题目链接:hdu_5793_A Boring Question 题意: 自己看吧,说不清楚了. 题解: 打表找规律 #include<cstdio> typedef long long l ...

  7. HDU 4696 Answers (2013多校10,1001题 )

    Answers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total S ...

  8. HDU 4686 Arc of Dream (2013多校9 1001 题,矩阵)

    Arc of Dream Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Tota ...

  9. HDU 4666 Hyperspace (2013多校7 1001题 最远曼哈顿距离)

    Hyperspace Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Tota ...

随机推荐

  1. JavaWeb项目开发案例精粹-第3章在线考试系统-004Service层

    1. package com.sanqing.service; import java.util.List; import com.sanqing.po.Student; public interfa ...

  2. Delphi判断字符串是否是数字、字母、大小写字母

    function IsNumberic(Vaule:String):Boolean; //判断Vaule是不是数字 var i:integer; begin result:=true; //设置返回值 ...

  3. Quartz动态添加、修改和删除定时任务

    任务调度开源框架Quartz动态添加.修改和删除定时任务 Quartz 是个开源的作业调度框架,为在 Java 应用程序中进行作业调度提供了简单却强大的机制.Quartz框架包含了调度器监听.作业和触 ...

  4. Spring与Hibernate整合

    Spring与Struts2整合的目的: 让Spring管理Action Spring整合Hinernate的目的: --管理SessionFactory(单例的),数据源 --声明式事务管理 1.首 ...

  5. sql中exists,not exists的用法

    exists : 强调的是是否返回结果集,不要求知道返回什么, 比如:  select name from student where sex = 'm' and mark exists(select ...

  6. swfupdate flash上传工具

    引用:http://baike.baidu.com/view/1332553.htm 下载地址:http://code.google.com/p/swfupload/ 什么是SWFUpload? SW ...

  7. 分布式ActiveMQ集群

    分布式ActiveMQ集群的部署配置细节: 官方资料:http://activemq.apache.org/clustering.html 基本上看这个就足够了,本文就不具体分析配置文件了. 1.Qu ...

  8. java匿名对象

    java学习面向对象之匿名内部类 之前我们提到“匿名”这个字眼的时候,是在学习new对象的时候,创建匿名对象的时候用到的,之所以说是匿名,是因为直接创建对象,而没有把这个对象赋值给某个值,才称之为匿名 ...

  9. VS2012安装英文的语言包后,调试的时候提示Unknown error:0x80040d10

    https://social.msdn.microsoft.com/Forums/en-US/e11a86ef-3be2-4256-92e9-d12809f2a6ca/error-0x80040d10 ...

  10. Bug:java.lang.IllegalStateException

    使用迭代的时候,出现了java.lang.IllegalStateException 代码: for ( TaskInfo info : userTaskInfos ) { if ( info.isC ...