提交记录 8329


用户 题目 状态 得分 用时 内存 语言 代码长度
LuoshuiTianyi noip18e. 【NOIP2018】填数游戏 Accepted 100 42.8 us 36 KB C++ 997 B
提交时间 评测时间
2019-02-12 19:15:40 2020-08-01 01:16:52
#include<iostream>
using namespace std;
int n,m,mod=1e9+7;
long long ksm(long long a,int n)
{
    long long base=1;
    while(n)
    {
        if(n%2)
            base=base*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return base;
}
int main()
{
    cin>>n>>m;
    if(n>m)
        swap(n,m);
    if(n==1)
        cout<<ksm(2,m);
    if(n==2)
        cout<<4ll*ksm(3,m-1)%mod;
    if(n==3)
        cout<<112ll*ksm(3,m-3)%mod;
    if(n==4)
        if(m==4)
            cout<<"912";
        else
            cout<<2688ll*ksm(3,m-5)%mod;
    if(n==5)
        if(m==5)
            cout<<"7136";
        else
            cout<<21321ll*ksm(3,m-6)%mod;
    if(n==6)
        if(m==6)
            cout<<"56768";
        else
            cout<<170112ll*ksm(3,m-7)%mod;
    if(n==7)
        if(m==7)
            cout<<"453504";
        else
            cout<<1360128ll*ksm(3,m-8)%mod;
    if(n==8)
        if(m==8)
            cout<<"3626752";
        else
            cout<<10879488ll*ksm(3,m-9)%mod;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #133.97 us36 KBAcceptedScore: 5

Testcase #242.8 us36 KBAcceptedScore: 5

Testcase #336.39 us36 KBAcceptedScore: 5

Testcase #435.04 us36 KBAcceptedScore: 5

Testcase #540.72 us36 KBAcceptedScore: 5

Testcase #634.2 us36 KBAcceptedScore: 5

Testcase #735.43 us36 KBAcceptedScore: 5

Testcase #835.19 us36 KBAcceptedScore: 5

Testcase #934.91 us36 KBAcceptedScore: 5

Testcase #1034.74 us36 KBAcceptedScore: 5

Testcase #1134.93 us36 KBAcceptedScore: 5

Testcase #1235.12 us36 KBAcceptedScore: 5

Testcase #1334.36 us36 KBAcceptedScore: 5

Testcase #1434.77 us36 KBAcceptedScore: 5

Testcase #1534.2 us36 KBAcceptedScore: 5

Testcase #1634.5 us36 KBAcceptedScore: 5

Testcase #1734.87 us36 KBAcceptedScore: 5

Testcase #1835.31 us36 KBAcceptedScore: 5

Testcase #1934.06 us36 KBAcceptedScore: 5

Testcase #2034.15 us36 KBAcceptedScore: 5


Judge Duck Online | 评测鸭在线
Server Time: 2020-10-31 11:54:11 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用