编程介的小学生 2019-11-11 10:27 采纳率: 20.5%
浏览 88

Family 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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
    • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
    • ¥15 乘性高斯噪声在深度学习网络中的应用
    • ¥15 运筹学排序问题中的在线排序
    • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛