codeforces#101194H. Great Cells(数学)
Posted carcar
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了codeforces#101194H. Great Cells(数学)相关的知识,希望对你有一定的参考价值。
题目链接:
题意:
数据范围:
$1\leq |S| \leq 1000 000$
分析:
AC代码:
#include<bits/stdc++.h> #define ll long long #define pic pair<int,char> #define pii pair<int,int> using namespace std; const int maxn=3e5+7; const int mod=1e9+7; ll qpow(ll x,ll y) ll res=1; while(y) if(y&1)res=res*x%mod; x=x*x%mod; y/=2; return res; int main() // cout<<qpow(2,10)<<endl; int T; scanf("%d",&T); for(int cn=1;cn<=T;cn++) int n,m,k; scanf("%d %d %d",&n,&m,&k); ll ans=qpow(k,n*m),res=0; for(int i=2;i<=k;i++) res=(res+qpow(i-1,n+m-2)*qpow(k,(n-1)*(m-1))%mod)%mod; ans=(ans+res*n*m%mod)%mod; printf("Case #%d: %lld\n",cn,ans); return 0;
以上是关于codeforces#101194H. Great Cells(数学)的主要内容,如果未能解决你的问题,请参考以下文章
CF [2016-2017 ACM-ICPC CHINA-Final][GYM 101194 H] Great Cells
codeforces #407(div1c div 2e)The Great Mixing
Codeforces 789e The Great Mixing (bitset dp 数学)
[acm/icpc2016ChinaFinal][CodeforcesGym101194] Mr. Panda and Fantastic Beasts