How is this Submission for the ATM problem wrong?

this is the link my submission. I don’t know why this submission always is wrong whenever I submit it because it satisfies all the parameters set in the question. Someone please help I’m out of my wits

It’s not showing your submission just edit the shared link…

1 Like

I just did

See line 10.

e = (e=b)+0.5;

I think you meant e == b.
Also check your logic again.

1 Like

but the code satisfied all the question’s parameters. I’ve gone over a million times

I think you just complicated the logic a lil bit…If you want you can refer to my submission
Solution

// yours one//e=(e=b)+0.5;
the problem lies here and the correct logic has to be e=(e=b)-0.5;
I think it will work now if you change it to this.

1 Like

For e.g.

b%5==0 && b>0 && a>0 && a<2000 && e<=a && b<=2000

You don’t need to check the range of input paramters (0 to 2000), they will be given in that range anyways.

You can just remove that, you could compare the code.
https://www.codechef.com/viewsolution/27110876

1 Like

interestingly, I just changed it but it still returned as wrong

to tell you the truth I’m a beginner and that I understood nothing of the #define… ‘things’
I would probably need more elaboration to understand your code.

     int a;
cin>>a;
double b;
cin>>b;
if(a%5==0)
{
	if(a<=(double)(b-0.5))
	{
		b=(double)(b-a-0.5);
	}
}
cout<<fixed<<setprecision(2)<<b<<endl;

now understand?? I just first took input …then just checked if the amount to be withdrawn is divisible by 5 or not…if yes…then just checked if the balance is greater or equal to the withdrawal money + 0.5 or not…that’s it

1 Like