[数学杂题] POJ3761 Bubble Sort
来源:互联网 发布:微信运动数据更新频率 编辑:程序博客网 时间:2024/06/05 19:15
#include<cstdio>#include<algorithm>using namespace std;typedef long long LL;const LL maxn=1000015, MOD=20100713;LL fac[maxn];int Pow(int a,int b){ LL res=1; for(LL w=a%MOD;b;b>>=1,w=w*w%MOD) if(b&1) res=(res*w)%MOD; return res;}int n,m,_test;int main(){ fac[0]=1; for(int i=1;i<=1000005;i++) fac[i]=fac[i-1]*i%MOD; scanf("%d",&_test); while(_test--){ scanf("%d%d",&n,&m); if(!m){ printf("1\n"); continue; } printf("%lld\n", (fac[m]*Pow(m+1,n-m)%MOD - fac[m-1]*Pow((m-1)+1,n-(m-1))%MOD +MOD)%MOD ); } return 0;}
阅读全文
0 0
- [数学杂题] POJ3761 Bubble Sort
- poj3761 bubble sort
- POJ3761 Bubble Sort
- 【反序表】POJ3761[Bubble Sort]题解
- poj3761 Bubble Sort(排列组合,逆序数,乘方取余)
- Bubble sort
- Bubble Sort
- bubble sort
- Bubble Sort
- Bubble Sort
- bubble sort
- Bubble Sort
- Bubble Sort
- Bubble Sort
- Bubble Sort
- Bubble Sort
- Bubble Sort
- Bubble Sort
- 使用单线程对文本分类的朴素贝叶斯模型的超参数组合执行网络搜索
- Mysql命令大全
- tornado协程使用和原理
- js创建对象 设计模式
- 51 nod 1596搬货物 (二进制进位或优先队列)
- [数学杂题] POJ3761 Bubble Sort
- RecycleView的适配器
- 红色*号字符垂直居中显示
- Android微信登录
- 八大排序
- ceph 基础知识梳理
- Mac下彻底卸载node和npm
- 数据库---基本概念
- java spring aop 个人笔记理解