HDU--杭电--2103--Family planning--水题

原创 2013年12月05日 00:13:16

Family planning

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 6645    Accepted Submission(s): 1709


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
 

题意:生孩子,输入n、m,允许生n个,然后是生了m和孩子,1是男,0是女,在规定范围内只能是女孩,如果出现男孩就不能生了,多出来的第一个孩子是10000块,卖增加一个孩子就多加2倍的钱,也就是说第二个20000,第三个40000,第四个80000....


#include <stdio.h>
int main ()
{
    __int64 t,n,m,i,j,k,l;
    scanf("%I64d",&t);
    while(t--&&scanf("%I64d%I64d",&m,&n))
    {
        for(i=l=0,j=10000;i<n;i++)
        {
            scanf("%I64d",&k);
            if(i<m&&k==1)m=0;
            else if(i>=m)l+=j,j*=2;
        }
        printf("%I64d RMB\n",l);
    }
    return 0;
}


相关文章推荐

HDU2103Family planning

Family planning Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)...
  • xu_fish
  • xu_fish
  • 2016年02月11日 20:38
  • 180

hdu 2103 Family planning

怎么说,这明显是一道大水题,不过我还是WA了一次,充分说明自己读题的不够仔细,特别是英文题的时候一定要看清题意  第一次做的时候没考虑到N AC代码:   #include #includ...

杭电OJ水题

  • 2015年06月23日 16:30
  • 52KB
  • 下载

杭电152道水题 适合初学者参考

  • 2013年04月26日 19:20
  • 65KB
  • 下载

【水题+字符串】杭电 hdu 1228 A + B

/* THE PROGRAM IS MADE BY PYY */ /*-----------------------------------------------------------------...

杭电 hdu 1033 (水题) 但英文特难,题意很难理解

Edge Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Subm...

杭电 hdu 1800 Flying to the Mars (水题 STL)

杭电  hdu  1800    Flying to the Mars  (水题   STL) Flying to the Mars Time Limit: 5000/10...

POJ、HDU、ZOJ、SOJ水题过滤器

  • 2011年11月08日 23:44
  • 702KB
  • 下载

杭电(HDU) OJ离线版

  • 2009年04月05日 22:46
  • 3.52MB
  • 下载

杭电OJ——1039 Easier Done Than Said?(水题)

Easier Done Than Said? Problem Description Password security is a tricky thing. Users prefer...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:HDU--杭电--2103--Family planning--水题
举报原因:
原因补充:

(最多只允许输入30个字)