MASS2 updated

Finally I understood the problem and produces correct output for all test cases.

problem link:-Mass2

my solution:-my solution

Accepted solution:- Correct one

logic similar to solution of correct one. Produces output which matches with accepted one.

Still Im getting WA for last test case can any one find corner case which my solution fails.

@l_returns I have coded as per ur algorithm I understood thanks but plz help me to find final case for which its getting wrong.

@vijju123 can u plz see to this because u know this problem

Thanks

plz anyone reply

Welcome code_man, I just checked you code… Seems that logic is fine… Good job you finally did that… Logic is definitely correct…
Try changing gets to scanf cuz input might have some “white spaces” which would get you wrong answer…
Do let me know if it worked or not…

1 Like

thanks finally for reply how much I shoul award u :wink: wait let me first try

1 Like

kya gyata hu toh refresh kari kari ne thako waiting for someones reply

1 Like

:slight_smile: It’s sunday… I took holiday from discuss codechef… though replied to you now…

1 Like

so it worked right ?

1 Like

It worked finally 10th trial thanks bro very happy. But scanf() will scan only till non whitespace character. so if foRmula has whitespace scan() will not consider entire formula but gets() will .So actually gets() should be working.??

ok may be in gets() if encountered whitespace might go into default case:

not matching any above case hence all blunder in calculation.Am I right?

The basic difference between them is…

#scanf() ends taking input upon encountering a whitespace, newline or EOF
#gets() considers a whitespace as a part of the input string and ends the input upon encountering newline or EOF.

link to the discussion on difference between them…

using gets is not safe and preferable…

can u throw light on diff between gets() and fgets(). why some online judge gives me error when I use gets() .

I already did \uparrow

Try changing gets to scanf cuz input might have some “white spaces” which would get you wrong answer…
Do let me know if it worked or not
https://cosmocarparts.com/brand/toyota/prado/
https://cosmocarparts.com/brand/toyota/corolla
https://cosmocarparts.com/brand/toyota/land-cruiser
https://cosmocarparts.com/brand/toyota/prius
https://cosmocarparts.com/brand/toyota/aqua

http://www.unikaas.com
http://bikeparts.pk
https://tnhprinter.com
https://tnhpackaging.com
https://mastorat.com/replica-clothing-supplier
http://thenethawks.com/