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

  • 相关阅读:
    centos 安装mysql
    mysql中文排序
    在Centos中yum安装和卸载软件的使用方法
    gcc升级方法
    tar命令
    wget命令
    php7安装及和php5的共存
    PHP SESSION 保存到数据库
    setTimeout延时0毫秒的作用和问题
    css display visibility
  • 原文地址:https://www.cnblogs.com/rainydays/p/2203551.html
Copyright © 2011-2022 走看看