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

建议使用的浏览器:

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

1766:Football

题目描述
Eric has a classic football that is made of 32 pieces of leather: 12 black pentagons and 20 white hexagons. Each pentagon adjoins 5 hexagons and each hexagon adjoins 3 pentagons and 3 hexagons. Eric drew a polygon (i.e. a closed line without intersections) along the edges of the pieces. The polygon divided the ball into two parts and Eric painted one of them green.

He is curious if given a description of the polygon you are able to compute the number of black, white and green pieces?

Task
Write a program that:

reads the description of a polygon,
computes the number of black, white and green pieces,
writes the result.
输入解释
The first line of the input contains one integer n being the number of vertices of the polygon. The second line of the input contains n integers a1, a2,..., an separated by single spaces. Integer ai (equal 1 or 2) is the number of green pieces adjoining the i-th vertex of the polygon. The side of the polygon connecting the n-th and the first vertex always lies between two hexagons.
输出解释
The first and only line of the output contains three integers b, w and g - the numbers of black, white and green pieces respectively.
输入样例
21
1 2 1 2 1 2 1 1 1 2 2 1 1 1 1 2 2 2 1 1 1
输出样例
11 15 6

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

题目来源 Central Europe 2003

源链接: POJ-1766

最后修改于 2020-10-29T06:13:27+00:00 由爬虫自动更新

共提交 0

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