编程介的小学生 2017-09-25 11:34 采纳率: 20.5%
浏览 781
已采纳

Football

Description

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

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

The first and only line of the output contains three integers b, w and g - the numbers of black, white and green pieces respectively.
Sample Input

21
1 2 1 2 1 2 1 1 1 2 2 1 1 1 1 2 2 2 1 1 1
Sample Output

11 15 6

  • 写回答

1条回答 默认 最新

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

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制