当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3542:History of Football

题目描述

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
TeamABCPoints
A-303
B0-33
C30-3
Possible table number 2
TeamABCPoints
A-033
B3-03
C03-3

Help Henry calculate the number of different possible tournament tables (without consideration of the scores of the games).

输入解释

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 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.

输入样例
3
3
3
3
输出样例
2
来自北京大学POJ的附加信息
Case time limit(单组数据时间限制) 2000MS

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3542

最后修改于 2020-10-29T07:04:04+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
8000 65536