4 条题解
-
2
12322132131231 (褚战) LV 10 @ 1 年前
-
13 年前@
-
14 年前@
#include<cstdio>
#define mod 1000000007
typedef long long LL;
inline LL ksm(LL a,LL b){LL r=1;for(;b;a=a*a%mod,b>>=1)if(b&1)r=r*a%mod;return r;}
int main()
{
int n,m;
scanf("%d%d",&n,&m);
if(n > m)n ^= m ^= n ^= m;
if(n == 1)printf("%lld",ksm(2,m));
else if(n == 2)printf("%lld",4*ksm(3,m-1)%mod);
else if(n == 3)printf("%lld",112*ksm(3,m-3)%mod);
else
{
if(m == n)printf("%lld",(83*ksm(8,n)%mod+5*ksm(2,n+7)%mod)*190104168%mod);
else printf("%lld",(83*ksm(8,n)%mod+ksm(2,n+8))*ksm(3,m-n-1)%mod*570312504%mod);
}
return 0;
} -
-32 年前@
- 1
信息
- ID
- 2062
- 难度
- 1
- 分类
- (无)
- 标签
- 递交数
- 36
- 已通过
- 29
- 通过率
- 81%
- 上传者