CODECHEF FEB COOK-OFF 2020 DOUBT (SLAB)

Hello everyone,

Could anyone please let me know what could be the possible mistake in,
my program : CodeChef: Practical coding for everyone

for the FEB COOK-OFF 2020 problem
“Tax Slabs” : CodeChef: Practical coding for everyone .

I have provided the link to my solution above.

Thanks & regards-
Neeraj Kumar.

I think In the last if statement you have mistakenly write 1500001 instead of 1500000 while adding to the tax.

Thanks @gurvir_221,

But could you also please check this solution for the same problem : CodeChef: Practical coding for everyone

[ It’s should have been AC, as have rectified the mistake …but still it’s WA ]

Please,let me know what could be the reason behind this ?
as :

 if (n>=1500001)  {  tax+=(abs(150000-n)*30)/100;  }  --> Got WA for this statement

AND

if (n>=1500001)   {  tax+=((n-1500000)*30)/100;  }   --> Got AC for this..( my latest submission)

are the same statements !!

Thanks once again :slight_smile:

Regards,
Neeraj Kumar

You are subtracting 1.5 lakh instead of 15 lakh. There should be one more 0(zero) in the first statement

1 Like

AH ! :frowning: A Biggest blunder done by me !!

Anyways,
Thanks @gurvir_221

Thanks a lot !!