编程介的小学生 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 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题