Why Biased result contest BYTERACE

what is the diff. between these two
one WA and one AC
https://www.codechef.com/viewsolution/40929105
https://www.codechef.com/viewsolution/40943572

return type of floor is float

3 Likes

floor() return type is double where a/b in CPP gives Integer result.
floor(6/2)=3.0
6/2=3
So that is why there is a problem.

2 Likes

u sure floor gives float ?

@cp_guy @uvaishzafri no men. u guys wrong. floor give integer return. any 7 star plz tell

1 Like

JIC YDK we can see your edits :slight_smile:

not understand @urvashi plz make clear

that the thing i want to ask why two diff result for same code

because your floor(k/n) return float value, which is not acceptable by judge. You could have wrote (long long) floor(k/n) or simply k/n to get desired result.

1 Like

C++ floor() - C++ Standard Library.

if you don’t believe me then see this article or else CPP Docs

1 Like

He is just fooling around. Don’t waste your time @cp_guy

can anyone check this code

https://www.codechef.com/viewsolution/40944002

Specifically, compare the output from the two solutions for the Test Input:

1
1 1000000
2 Likes

ohhhh now i got
thnku

1 Like

this worked int x=floor(k/n);
cout<<x<<endl;