编程介的小学生 2017-10-18 01:00 采纳率: 20.5%
浏览 677
已采纳

History of Football

Description

Henry is a historian. He specializes in the history of sports, especially football. Whenever he sees a table of a football tournament, he saves it into his database.

Recently he ran across a web-site with standings of a small tournament. Unfortunately for him, the results of the games were lost, and the only available information was the amount of points gained by each team.

Disappointed by that, he decides to have some mathematical fun and to calculate in how many different ways the games of the championship could have ended. He doesn’t care about the scores of the games, he only cares about the winners.

In that tournament the following rules were applied:

Each team plays against each other team exactly once.
In case of a tie each team gains 1 point.
In other case the winner gains 3 points and the loser gains 0 points.
For example, if Henry knows that each of 3 teams had got 3 points by the end of the tournament, the answer to his question is that there are two possible tournament tables:

Possible table number 1
Team A B C Points
A - 3 0 3
B 0 - 3 3
C 3 0 - 3
Possible table number 2
Team A B C Points
A - 0 3 3
B 3 - 0 3
C 0 3 - 3
Help Henry calculate the number of different possible tournament tables (without consideration of the scores of the games).

Input

Input file contains integer n, the number of teams in the championship (2 ≤ n ≤ 8). The following n lines contain one integer number each — points gained by the teams.

Output

Output one integer number — the number of possible tournament tables with given total points. It is guaranteed that there is at least one such tournament table.

Sample Input

3
3
3
3
Sample Output

2

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-11-02 14:12
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看