|
|
вернуться в форумGive me answer for my question. Please! if (a == b*q+p) and (0 <= p < |b|) then { q == a / b p == a % b } is it TRUE? Edited by author 13.02.2007 14:34 Re: Give me answer for my question. Please! a % b == p - correct a / b is standard (just a / b in your programming language) Re: Give me answer for my question. Please! To WiNGeR: I should use SIGHNED INT32 or UNSIGHNED INT32 P.S. Sorry for bad English. Edited by author 13.02.2007 18:57 Re: Give me answer for my question. Please! SIGNED INT32 Re: Give me answer for my question. Please! 0 <= |p| < |b| correct because if p = a - b * q, and q = a / b, you can see, p should be negative for negative a. But sample test provides positive remainder. I think this is mistake in tests. Use this p = a % b; if (p < 0) p += abs(b); Edited by author 11.09.2010 05:45 |
|
|