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

建议使用的浏览器:

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

1277:Beer Land

题目描述
King ACM 2002 received some clear ground and some money through inheritance. Terms of the will and testament require the heir to build n towns. He was also required to build the least quantity of two-way roads between the towns such that one could travel from any town to any other town even if one road was closed under repair. Carefully, all such roads must be constructed as geometrically straight lines. Further, the condition that a traveller be able to get from one town to another (even with one road closed) needs to be satisfied by traversing the roads as straight lines in their entirety --- not stopping partway along one road to switch to another.
Because of rich soil in those lands, the future inhabitants of the place have decided to produce beer. On the crossroads (a crossroad is merey the intersection of two or more roads) the king plans to build beer stands (one stand per a crossroad). So, if three or four (or twenty) roads intersect in a single point, there抯 still only one appropriate place for a beer stand. The King must choose locations for the towns and the roads. You need to advise him so that he builds as many beer stands as possible.
输入解释
The first line of input contains the number of test cases. For each case there is a line containing a single integer n (1 <= n <= 32767). This represents the number of towns to be built.
输出解释
For each n, print a line containing the maximum number of beer stands possible to build.
输入样例
3
3
4
5
输出样例
0
1
5

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

源链接: POJ-1277

最后修改于 2020-10-29T05:59:51+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 10000