Help with sopj problem

Problem link
solution link

when I used this cout after printf it gives me wrong answer since in soltion all the answers are wriiten in a single line, but i have used endl…
when i use printf("%0.1lf\n",ans) it gives me the right answer. and actualy in the solution all cout<<endl is implemented before printf statement. I dont know why, please help.

I think problem is because of fast i/o. Try after removing it.

1 Like

yeah, thanx… it worked but i am really keen to know what is the problem with fast i/o method

When you use fast input output, refrain from using printf. It messes up the order. If you want to use printf, then use only that. You can flush the output with fflush(stdout).

thanks man…