标签:out def div case codeforce std main its ORC
$1\leq |S| \leq 1000 000$
#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(数学)
标签:out def div case codeforce std main its ORC
原文地址:https://www.cnblogs.com/carcar/p/11629560.html