2013
12-29

# Family planning

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.

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.

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.

2
2 5
0 0 1 1 1

2 2
0 0

70000 RMB
0 RMB

http://acm.hdu.edu.cn/showproblem.php?pid=2103

bs这道题，我坚信生男生女都一样！

ps:不提前把几个0打出来的话要用__int64，否则会超范围

#include <stdio.h>

int main()
{
int t,m,n;
int i;
int bb,cnt,f;
__int64 ans,fj;
scanf("%d",&t);
while(t--)
{
cnt=ans=f=0;
fj=10000;
scanf("%d%d",&m,&n);
for(i=0;i<n;i++)
{
scanf("%d",&bb);
if(cnt==m||f)
{
ans+=fj;
fj<<=1;
}
else
{
if(bb)
f=1;
else
cnt++;
}
}
printf("%I64d RMB\n",ans);
}
return 0;
}

1. 我一朋友找了个女朋友是外地的，第一次带到家里玩，白天两人出去到山上玩了。晚上回来不对劲了，和这个情况差不多，我也去看了。你们猜怎么着？她竟然我我们的家乡话！要知道她是南方人 普通话都咬舌头呢，怎么会我们这的方言？？？折腾了一晚上。

2. 我一朋友找了个女朋友是外地的，第一次带到家里玩，白天两人出去到山上玩了。晚上回来不对劲了，和这个情况差不多，我也去看了。你们猜怎么着？她竟然我我们的家乡话！要知道她是南方人 普通话都咬舌头呢，怎么会我们这的方言？？？折腾了一晚上。

3. 我一朋友找了个女朋友是外地的，第一次带到家里玩，白天两人出去到山上玩了。晚上回来不对劲了，和这个情况差不多，我也去看了。你们猜怎么着？她竟然我我们的家乡话！要知道她是南方人 普通话都咬舌头呢，怎么会我们这的方言？？？折腾了一晚上。

4. 我一朋友找了个女朋友是外地的，第一次带到家里玩，白天两人出去到山上玩了。晚上回来不对劲了，和这个情况差不多，我也去看了。你们猜怎么着？她竟然我我们的家乡话！要知道她是南方人 普通话都咬舌头呢，怎么会我们这的方言？？？折腾了一晚上。

5. 我一朋友找了个女朋友是外地的，第一次带到家里玩，白天两人出去到山上玩了。晚上回来不对劲了，和这个情况差不多，我也去看了。你们猜怎么着？她竟然我我们的家乡话！要知道她是南方人 普通话都咬舌头呢，怎么会我们这的方言？？？折腾了一晚上。

6. 我一朋友找了个女朋友是外地的，第一次带到家里玩，白天两人出去到山上玩了。晚上回来不对劲了，和这个情况差不多，我也去看了。你们猜怎么着？她竟然我我们的家乡话！要知道她是南方人 普通话都咬舌头呢，怎么会我们这的方言？？？折腾了一晚上。

7. 约瑟夫也用说这么长……很成熟的一个问题了，分治的方法解起来o(n)就可以了，有兴趣可以看看具体数学的第一章，关于约瑟夫问题推导出了一系列的结论，很漂亮

8. 网站做得很好看，内容也多，全。前段时间在博客园里看到有人说：网页的好坏看字体。觉得微软雅黑的字体很好看，然后现在这个网站也用的这个字体！nice!