← Back to topics
Topic

Task::IT

D
Diabolic
Hello! I am 100% that's the results from the tests are correct, but still I am getting wrong result. Could you possible check my code ?
http://www.z-trening.com/new/www/html/submit.php?submit=7100041526&subm_code=1
A
Amtrix
You compare two doubles with == ....
Try comparing like
fabs( double - double) <0.0000001
D
Diabolic
Why I can't compare two doubles with == ?
Could you possibly tell me where to put:
fabs( double - double) <0.0000001 ?
A
Amtrix
Well 5 isn't five in double....
5 could be:
5 = 5.000000000000000034
5 = 5.0000000000000001
5 = 5.00000000000000456
Dont aks me why....
p
picsel
If you have to check if A=B, then do it
fabs(A-B)<0.000001
So just replace A and B with whatever you need for this task
D
Diabolic
Still I can't get it working.
I tried with int(A)=int(B), but only 3 of 10 has passed the test.
p
picsel
fabs(q - (m*p+b))<0.00001
D
Diabolic
yes, that's what I tried, not working.
I also #include <cmath> to get work fabs
p
picsel
write it like this
if ((p>=0) && (fabs(q-(m*p+b))<0.00001)) brojac++;
b
boris4
use scanf, printf to avoid TLE

scanf( "%lf %lf" ), without , between %lf and %lf
D
Diabolic
@picsel
thank you very much for the help. Now works. I could never imagine that ( ) could make some problem.

@boris4
Thank you very much for the tip. Now there is no TLE :-)