编程介的小学生
2017-11-30 16:44Family planning
Problem Description
As far as we known,there are so many people in this world,expecially in china.But many people like LJ always insist on that more people more power.And he often says he will burn as much babies as he could.Unfortunatly,the president XiaoHu already found LJ's extreme mind,so he have to publish a policy to control the population from keep on growing.According the fact that there are much more men than women,and some parents are rich and well educated,so the president XiaoHu made a family planning policy:
According to every parents conditions to establish a number M which means that parents can born M children at most.But once borned a boy them can't born other babies any more.If anyone break the policy will punished for 10000RMB for the first time ,and twice for the next time.For example,if LJ only allowed to born 3 babies at most,but his first baby is a boy ,but he keep on borning another 3 babies, so he will be punished for 70000RMB(10000+20000+40000) totaly.
Input
The first line of the input contains an integer T(1 <= T <= 100) which means the number of test cases.In every case first input two integers M(0<=M<=30) and N(0<=N<=30),N represent the number of babies a couple borned,then in the follow line are N binary numbers,0 represent girl,and 1 represent boy.
Output
Foreach test case you should output the total money a couple have to pay for their babies.
Sample Input
2
2 5
0 0 1 1 1
2 2
0 0
Sample Output
70000 RMB
0 RMB
- 点赞
- 回答
- 收藏
- 复制链接分享
1条回答
为你推荐
- Flickr组池照片 - 如何下载所有组照片
- api
- flickr
- ruby
- php
- 1个回答
- 只允许pdf / images的表单提交空白[关闭]
- html
- javascript
- wordpress
- php
- html5
- 1个回答
- 回显从控制器发送的数据
- codeigniter
- mysql
- php
- 1个回答
- Ninja Forms自定义PDF模板返回错误
- wordpress
- php
- 1个回答
- 如何获得此对象的结果数?
- object
- arrays
- php
- jquery
- 2个回答