No. of black balls invalid
No. of black balls invalid
0
No. of black balls invalid
No. of red balls invalid
No. of red balls invalid
No. of red balls invalid
No. of red balls invalid
0
No. of black balls invalid
No. of black balls invalid
No. of black balls invalid
1
0
No. of black balls invalid
No. of red balls invalid
No. of red balls invalid
No. of red balls invalid
No. of red balls invalid
No. of red balls invalid
No. of red balls invalid
No. of red balls invalid
No. of red balls invalid
No. of red balls invalid
No. of red balls invalid
No. of red balls invalid
No. of black balls invalid
No. of black balls invalid
0
No. of black balls invalid
No. of black balls invalid
No. of black balls invalid
3
2
1
No. of black balls invalid
1450
950 1151
450 651
0 201
151
0
No. of black balls invalid
No. of red balls invalid
109 492
No. of black balls invalid
No. of red balls invalid
194
211 1090
254 2655
No. of black balls invalid
No. of red balls invalid
37 298
918
No. of black balls invalid
570 1905
2179
441
567
78
No. of black balls invalid
No. of red balls invalid
1135
No. of red balls invalid
1367
79
65
3 32
1418
367
No. of red balls invalid
No. of red balls invalid
No. of red balls invalid
My input are not critical at all. Just some random cases. Since there is no input range specification, the input integers may be quite large. Beware of overflow if you square anything. My code only works if the input integer is less than 200000000, so there should be no input larger than that.
Again same output.why wrong answer ? My procedure is :
1. First I solve the equation to find the roots.
2.if the roots are fractional then R false.
3.Otherwise . if they are not less than .7 or negetive B false.
4.if not,print the root / roots by checking them.
Then it's probably because of the floating point error. Try to revisit your formula. It's possible to solve everything without any floating point operation. Maybe your code will fail on some of the following cases:
Thanks again Cho. same output again without any modify. its may be floating point error. Ok, i'll try to solve without floating point oparetion. but i can't understand without floating point calculation how do i know that red balls are invalid?
To Shamim
when the roots become negetive then this case is cheked autometically.
is it ?