5 人解决,18 人已尝试。
5 份提交通过,共有 54 份提交。
8.7 EMB 奖励。
单点时限: 2.0 sec
内存限制: 256 MB
You are attempting to create a new game that is played by rolling several dice. In order to determine scoring, you need to first know how many different formations can be rolled with those dice. We define a formation as the collection of values that are shown on the dice, without regard to order. Thus, {1, 1, 2}, {1, 2, 1}, and {2, 1, 1} are all the same formation, whereas {1, 1, 2}, {1, 2, 2} and {1, 1, 3} are all different formations. Note that even though two dice may have a different number of sides, for the purpose of counting formations, only the number shown on them matters.
There are many tests.In each test there are two lines,the first line is a interger N(1<=N<=32),then next line n interger followed.where the i-th element is the number of sides on the i-th die. The sides of an n-sided die contain all numbers between 1 and n(1<=n<=32), inclusive.
Output the number of different formations that can be made from those dice.
2 2 2 2 4 4
3 10 Hint 1: case 1:This is essentially the equivalent of flipping two coins. We can get Heads/Heads, Heads/Tails, or Tails/Tails. case 2:Here, there are 10 formations we can make: {1, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 2}, {2, 3}, {2, 4}, {3, 3}, {3, 4}, {4, 4}
5 人解决,18 人已尝试。
5 份提交通过,共有 54 份提交。
8.7 EMB 奖励。
创建: 16 年,7 月前.
修改: 7 年,3 月前.
最后提交: 4 年前.
来源: N/A