作业帮 > 综合 > 作业

杭电acm2103求助,下面是我的代码,我试过了许多数据都通过了,可是总被WA,

来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/07/31 04:33:16
杭电acm2103求助,下面是我的代码,我试过了许多数据都通过了,可是总被WA,
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
杭电acm2103求助,下面是我的代码,我试过了许多数据都通过了,可是总被WA,
这题目有意思,计划生育,还president XiaoHu,亏他想得出来.
同意一楼的看法,你还缺了一种情况没考虑:M = 0(这不是不给生孩子嘛!出题者也够绝的.)
找出问题就好解决的,修改两处即可.(当然,还有其他方法,你的代码你最清楚)
#include
using namespace std;
int main()
{
int M,N,baby[31],i,T;
__int64 p,s;
scanf("%d",&T);
while(T--&&scanf("%d%d",&M,&N)!=EOF)
{
for(i=1;i