|
|
if a = 0 and b = 0 => r = 0 and q every complex number => count solation equation = infinity I can't understand what is wrong? Maby something with calculations and rounding??? Can anyone help me? Thanks [code deleted] Edited by moderator 22.02.2006 00:48 correst your x and y to: [code deleted] Edited by author 21.11.2005 04:45 Edited by moderator 22.02.2006 00:49 Can you tell me how to solve this problem?? Утверждение: задача эквивалентна следующей: нужно найти все комплексные q с целыми коэффициентами, удовлетворяющие |a-bq|<|b|. Если |b|=0, то решений нет Иначе |b|>0. Тогда условие эквивалентно |a/b - z|<1. Пусть a=a1+b1i, b=a2+b2i, q=q1+q2i. Тогда получим |alfa/gamma-q1+i(beta/gamma+q2)|<1 <=> ((alfa-gamma*q1)/gamma)^2+((beta+gamma*q2)/gamma)^2<1, где gamma=a2*a2+b2*b2, alfa=(a1*a2+b1*b2)/gamma, beta=i(a2*b1-a1*b2)/gamma. Теперь просто можно пройтись по всем q1 и q2 (они меняются от -1+alfa/gamma до 1+alfa/gamma и от -1-beta/gamma до 1-beta/gamma) и проверить условие. Can you generate me some tests with answers? I'd like to check my program. Put R+,Q+. Try this: 1000000 1000000 1000000 1000000 1 1000000 1000000 999999 1000000 3 1000000 0 1 1000000 2 I think that answer on the last test must be 3. (1+1000000i)*(-i)+i=1000000 (1+1000000i)*(1-i)-1-999999i=1000000 (1+1000000i)*0+1000000=1000000 Some random tests: 21 56 32 45 3 90 87 45 23 4 234 876 129 623 2 12345 65 8967 1345 3 4563 897 156 734 4 4 6 7 8 3 Or too complex ? What q,r for test in example ? All are complex! in example: q1=-2i r1=2 q2=-3i r2=-3 Complex, but with integer components I always get wa6.Is there anybody who knows what that test is? Edited by author 25.06.2008 23:44 If you have a WA4 you may take in account that q = 0+0i too is an answer. Though I don't understand why what mean |b| for complex? for example: b=7+0i |b|=? b=7-2i |b|=? b=-2i |b|=? Edited by author 20.10.2006 19:00 b=x+y*i |b|=Sqrt(x*x+y*y) 12 0 0 5 - what this and why answer = 2 Please, help me with this problem. At first, when I saw this problem, I thought that it's very easy, but then... My solution #1: [code deleted] But at test #6 time isn't enough. My solution #2: [code deleted] And test #6 again. Please, I can't find the error. Maybe does anybody know this test. Thanks for any information. Edited by moderator 22.02.2006 00:50 |
|
|