zoukankan      html  css  js  c++  java
  • poj3036

    记忆化搜索

    View Code
    #include <iostream>
    #include <cstdlib>
    #include <cstring>
    #include <cstdio>
    using namespace std;

    int f[] = {1, 0, 6, 12, 90, 360, 2040, 10080, 54810, 290640, 1588356, 8676360, 47977776, 266378112, 1488801600};
    int n;

    int main()
    {
    //freopen("t.txt", "r", stdin);
    int t;
    scanf("%d", &t);
    while (t--)
    {
    scanf("%d", &n);
    printf("%d\n", f[n]);
    }
    return 0;
    }
    //#include <iostream>
    //#include <cstdlib>
    //#include <cstring>
    //#include <cstdio>
    //using namespace std;
    //
    //int f[100][100][20];
    //
    //int cal(int x, int y, int step)
    //{
    // if (f[x][y][step])
    // return f[x][y][step];
    // if (step == 0)
    // return x == 50 && y == 50;
    // f[x][y][step] += cal(x + 1, y + 1, step - 1);
    // f[x][y][step] += cal(x + 1, y, step - 1);
    // f[x][y][step] += cal(x, y + 1, step - 1);
    // f[x][y][step] += cal(x - 1, y - 1, step - 1);
    // f[x][y][step] += cal(x - 1, y, step - 1);
    // f[x][y][step] += cal(x, y - 1, step - 1);
    // return f[x][y][step];
    //}
    //
    //int main()
    //{
    // freopen("t.txt", "r", stdin);
    // for (int i = 2; i < 14; i++)
    // printf("%d,", cal(50, 50, i));
    // return 0;
    //}

  • 相关阅读:
    python 线程之 数据同步 Queue
    python 线程之threading(五)
    python 线程之 threading(四)
    python 线程之 threading(三)
    php-属性和方法的重载
    wordpress-4.7.2-zh_CN页面加载慢
    php-__autoload()
    php-_toString()方法
    php-final
    php-parent::和self::
  • 原文地址:https://www.cnblogs.com/rainydays/p/2203551.html
Copyright © 2011-2022 走看看