编程介的小学生 2017-04-24 15:44 采纳率: 20.5%
浏览 919
已采纳

Divide and Count

Jack has several beautiful diamonds, each of them is unique thus precious. To keep them safe, he wants to divide and store them in different locations. First, he has bought some coffers. These boxes are identical except that their capacities (the number of the diamonds that a box can contain) may diverse. Before he puts his diamonds in, he wants to figure out how many different ways he can store these diamonds into the coffers. He recruits you, a young programmer from Zhejiang University, to give him the answer.

Input:
The input consists of several test cases. Each test case begins with a positive integer N, which indicates the number of the coffers Jack has bought. Then the following N integers are the capacities of each box. The total number of the diamonds Jack has equals to the sum of the capacities of all the coffers.

All the integers given are no greater than 12, you can be assured that a result always fits into a 32-bit integer.

Output:
For every test case, print out an integer representing the number of the different ways Jack can store his diamonds. Each integer is to be printed on a single line.

Sample input:
2
3 3
3
1 2 3

Sample output:
10
60

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-05-09 15:52
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 对于知识的学以致用的解释
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败