题解:P2289 [HNOI2004] 邮递员

· · 题解

做法:可以看到数据范围:

#include<bits/stdc++.h>
using namespace std;
int main()
{
    short a,b;
    cin >> a >> b;
    if(a==1||b==1)
        cout << 1;
    else if(a==4)
        cout << 12;
    else if(a<=7&&b<=7)
        cout << 2144;
    else if(a<=7&&b<=8)
        cout << 602768;
    else if(a<=9&&b<=8)
        cout << 9277152;
    else if(a<=10&&b<=8)
        cout << 3034;
    else if(a<=9&&b<=10)
        cout << 2048056;
    else if(a<=10&&b<=10)
        cout << 934520913216;
    else if(a<=12&&b<=18)
        cout << 619313040592944136;
    else {
        cout << 1770290332851483406;//这里太长了,不能直接输出,分开输出即可。
        cout << 52006844;
    }
    return 0;
}