Working in a boutique folding and putting in order T-shirts according to their sizes seems very easy. But is it really so simple?
    Given n objects of different sizes, how many different arrangements can be done using relationships ‘¡’ and ‘=’?
    For instance, with 2 objects, A and B, we have 3 possible arrangements:
A=B A¡B B¡A
    With 3 objects, A, B and C, you must conclude that 13 different arrangements exist:
A=B=C A=B¡C A¡B=C A¡B¡C A¡C¡B A=C¡B B¡A=C B¡A¡C B¡C¡A B=C¡A C¡A=B C¡A¡B C¡B¡A
Input
The first line of the input contains an integer, t, indicating the number of test cases. For each test case, one line appears, that contains a number n, 1 ≤ n ≤ 11, representing the number of objects.
Output
For each test case, the output should contain a single line with the number representing the different arrangements you can do with n objects.
Sample Input
4
1
2
3
4
Sample Output
1
3
13
75

问题链接:UVA12022 Ordering T-shirts
问题简述:(略)
问题分析:数学问题,离线打表是必要的。
程序说明:(略)
参考链接:(略)
题记:(略)

AC的C++语言程序如下:

/* UVA12022 Ordering T-shirts */#include <bits/stdc++.h>using namespace std;const int num[] = {1, 1, 3, 13, 75, 541, 4683, 47293, 545835, 7087261, 102247563, 1622632573};int main()
{int t, n;scanf("%d", &t);while (t--) {scanf("%d", &n);printf("%d\n", num[n]);}return 0;
}

AC的C++语言程序如下:

/* UVA12022 Ordering T-shirts */#include <bits/stdc++.h>using namespace std;const int N = 11;
int nr[N + 1][N + 1], num[N + 1];int main()
{for (int i = 0; i <= N; i++)for (int j = 0; j <= i; j++)if (i == j) nr[i][j] = 1;else if (j == 0) nr [i][j] = 1;else if (j == 1) nr [i][j] = i;else nr[i][j] = nr[i - 1][j] + nr[i - 1][j - 1];num[0] = 1;num[1] = 1;num[2] = 3;for (int i = 3; i <= N; i++)for (int j = 0; j <= i; j++)num[i] += nr[i][j] * num[i - j];int t, n;scanf("%d", &t);while (t--) {scanf("%d", &n);printf("%d\n", num[n]);}return 0;
}

UVA12022 Ordering T-shirts【数学+打表】相关推荐

  1. python函数打印乘法表_Python中内置函数来打印数学乘法表

    1.Python内置函数range的使用 range函数的作用可以理解取一个范围如下: >>>range(5) # :取一个在5的范围>range(0, 5) # 那么在这里取 ...

  2. Texlive: latex数学符号表

    http://zh.wikipedia.org/wiki/Help:MATH 函数.符号及特殊字符 声调 语法 效果 语法 效果 语法 效果 \bar{x} \acute{\eta} \check{\ ...

  3. Latex 数学符号表

    转载于:https://www.cnblogs.com/joyfulphysics/p/5177101.html

  4. LaTex常用数学符号表

    参考资料:LaTex90分钟快速入门

  5. 机器学习常见的数学符号表

    参考<统计学习方法>

  6. SAT数学必备词汇表

    下面为大家总结的是SAT数学词汇表.SAT数学考试的题目难度对于中国的考生来说非常低,大家解答SAT数学考试最大的困难在于掌握SAT数学词汇.下面的SAT数学必备词汇是大家在备考SAT数学考试中一定会 ...

  7. SAT数学必备词汇表介绍

    下面为大家总结的是SAT数学词汇表.SAT数学考试的题目难度对于中国的考生来说非常低,大家解答SAT数学考试最大的困难在于掌握SAT数学词汇.下面的SAT数学必备词汇是大家在备考SAT数学考试中一定会 ...

  8. 【Tools】Markdown数学符号公式(史上最全公式表)

    Markdown数学符号&公式 文章目录 Markdown数学符号&公式 1. 希腊字母表 2. 希腊字母 3. 数学符号表 4. 数学符号 5. 数学符号补充表 6. 数学符号补充 ...

  9. 干货丨一文介绍机器学习中基本的数学符号

    在机器学习中,你永远都绕不过数学符号. 通常,只要有一个代数项或一个方程符号看不懂,你就完全看不懂整个过程是怎么回事了.这种境况非常令人沮丧,尤其是对于那些正在成长中的机器学习初学者来说更是如此. 如 ...

最新文章

  1. java 高级数据类型_【高级数据类型】- 2.通道的更多种类
  2. fiddler自动保存mysql_Fiddler模拟自动响应数据
  3. 团队博客第五周 运行与总结
  4. 【java】为什么HashMap桶中节点个数超过8才转为红黑树?
  5. 《Unix网络编程》卷一(简介TCP/IP、基础套接字编程)
  6. 码表的理解(ASCII,GBK,Unicode,UTF-8等)。
  7. A-Night at the Museum 水题
  8. 趣图:21 副 GIF 动图让你了解各种数学概念
  9. SparkSQL中数据集类的封装
  10. KL与JS散度学习[转载]
  11. 高级编程语言学习概论
  12. 通用电源模块的测试方法及性能指标
  13. 一刀工具箱 - 成语查询工具
  14. 华为云ECS服务器中通过docker部署jenkins
  15. confluence 制作流程图_「每周开方」 高效制作流程图、思维导图
  16. unity导出android,可以显示出MMD模型,但是不能播放动作。求解答
  17. 什么是国外LEAD?
  18. IDEA maven webapp项目not find catalina.jar 错误
  19. gitlab集成ldap认证
  20. 做小红书7年,这些踩雷点一定要告诉你

热门文章

  1. 管理系统中的计算机应用数据库系统,自考管理系统中的计算机应用重点: 数据库系统(1)...
  2. MongoDB(Golang)常用复合查询
  3. WebStorm——最智能的Javascript IDE
  4. 使用jQuery Mobile快速开发手机站点
  5. (转)Managed DirectX +C# 开发(入门篇)(六)
  6. 剑指 Offer 06. 从尾到头打印链表-力扣
  7. 在Linux上安装Mysql 以及 涉及问题
  8. mysql的压缩包,mysql 压缩包安装
  9. fscanf读出来的数字不正确_听了那么多数字英文儿歌,这位牛妈的做法却最能引导孩子输出!...
  10. LeetCode50. Pow(x, n)(二进制位运算)