链接:https://ac.nowcoder.com/acm/contest/330/E
来源:牛客网
仅一行两个正整数 n, m,表示方阵的大小。
输出一个正整数,表示方案数对 109+7109+7 取模。
2 2
4
1≤n,m≤10100000
欧拉降幂公式:

#include<stdio.h> #include<iostream> #include<algorithm> #include<cstring> #include<string> #include<queue> #include<math.h> #define ll long long #define inf 0x3f3f3f3f using namespace std; const ll p=1e9+7; const ll x=p-1; char a[100086],b[100086]; int c[100086]; ll power(ll a,ll b) { ll ans=1; while(b) { if(b%2) ans=ans*a%p; a=a*a%p; b=b/2; } return ans%p; } int main() { scanf("%s%s",a,b); int len=strlen(a); for(int i=0;i<len;i++) c[i]=a[i]-‘0‘; ll res=0; for(int i=0;i<len;i++) { res=(res*10+c[i])%x; } printf("%lld",power(2,res+x)); return 0; } //欧拉降幂公式:在%m时,指数k = k%oula(m)+oula(m)
原文:https://www.cnblogs.com/shoulinniao/p/10352426.html