题解

4 条题解

  • 2
    @ 2023-07-07 12:26:54
    #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;
    }
    
    
  • 1
    @ 2021-10-16 11:30:04
    #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;
    }
    
  • 1
    @ 2020-04-30 17:27:58

    #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;
    }

  • -3
    @ 2022-07-16 22:31:54

    \(\rule{10000000mm}{100000000mm}\)

  • 1

信息

ID
2062
难度
1
分类
(无)
标签
递交数
34
已通过
27
通过率
79%
上传者