提交记录 11316


用户 题目 状态 得分 用时 内存 语言 代码长度
newbiechd noip18e. 【NOIP2018】填数游戏 Accepted 100 4.176 ms 16 KB C++11 1.60 KB
提交时间 评测时间
2019-11-14 22:04:51 2020-08-01 02:42:18
// Written By NewbieChd
#include <cstdio>
using namespace std;

const int mod = 1e9 + 7;
inline void swap(int& x, int& y) { x ^= y, y ^= x, x ^= y; }

int main() {
    int n, m, i, ans;
    scanf("%d%d", &n, &m);
    if (n > m)
        swap(n, m);
    
    if (n == 1) {
        ans = 2;
        for (i = 1; i < m; ++i)
            ans = (ans << 1) % mod;
    }
    
    if (n == 2) {
        ans = 12;
        for (i = 2; i < m; ++i)
            ans = 3ll * ans % mod;
    }
    
    if (n == 3) {
        ans = 112;
        for (i = 3; i < m; ++i)
            ans = 3ll * ans % mod;
    }
    
    if (n == 4) {
        if (m == 4)
            ans = 912;
        else {
            ans = 2688;
            for (i = 5; i < m; ++i)
                ans = 3ll * ans % mod;
        }
    }
    
    if (n == 5) {
        if (m == 5)
            ans = 7136;
        else {
            ans = 21312;
            for (i = 6; i < m; ++i)
                ans = 3ll * ans % mod;
        }
    }
    
    if (n == 6) {
        if (m == 6)
            ans = 56768;
        else {
            ans = 170112;
            for (i = 7; i < m; ++i)
                ans = 3ll * ans % mod;
        }
    }
    
    if (n == 7) {
        if (m == 7)
            ans = 453504;
        else {
            ans = 1360128;
            for (i = 8; i < m; ++i)
                ans = 3ll * ans % mod;
        }
    }
    
    if (n == 8) {
        if (m == 8)
            ans = 3626752;
        else {
            ans = 10879488;
            for (i = 9; i < m; ++i)
                ans = 3ll * ans % mod;
        }
    }
    
    printf("%d\n", ans);
    return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #18.64 us16 KBAcceptedScore: 5

Testcase #211.43 us16 KBAcceptedScore: 5

Testcase #38.94 us16 KBAcceptedScore: 5

Testcase #48.11 us16 KBAcceptedScore: 5

Testcase #54.01 ms16 KBAcceptedScore: 5

Testcase #64.167 ms16 KBAcceptedScore: 5

Testcase #74.127 ms16 KBAcceptedScore: 5

Testcase #84.045 ms16 KBAcceptedScore: 5

Testcase #94.097 ms16 KBAcceptedScore: 5

Testcase #104.157 ms16 KBAcceptedScore: 5

Testcase #114.014 ms16 KBAcceptedScore: 5

Testcase #123.991 ms16 KBAcceptedScore: 5

Testcase #134.017 ms16 KBAcceptedScore: 5

Testcase #148.42 us16 KBAcceptedScore: 5

Testcase #158.32 us16 KBAcceptedScore: 5

Testcase #167.98 us16 KBAcceptedScore: 5

Testcase #174.176 ms16 KBAcceptedScore: 5

Testcase #184.064 ms16 KBAcceptedScore: 5

Testcase #194.164 ms16 KBAcceptedScore: 5

Testcase #203.981 ms16 KBAcceptedScore: 5


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