|
|
When n > 6 the cases are wrong. Try to do it without placing a circle in the center. When n > 5 I guess, you can place one or more circles to free place within polygon? I assume that answer for 5 and 6 is same ive googled that the answer for all n except 1 is 1 + 1/sin(PI/n), can smb explane me why? Centers of circles form a regular polygon with side length 2. Now, consider the formula to find circumradius of a regular polygon and add 1 because you were connecting circle centres, but not their tangent points to the circle. for n:=1 to 50 do : 1 2 2.15470053837925 2.41421356237309 2.70130161670408 3 3.30476487096249 3.61312592975275 3.92380440016309 4.23606797749979 4.54946553288422 4.86370330515627 5.17858146886038 5.49395920743493 5.80973434474413 6.12583089548301 6.44219115175181 6.75877048314363 7.07553382097426 7.39245322149966 7.7095061398084 8.02667418333227 8.34394219610391 8.66129757554039 8.97872975555948 9.29622981055875 9.61379014847791 9.93140427038051 10.2490665803026 10.5667722335056 10.8845170143696 11.2022972373783 11.520109666252 11.8379514474594 12.155820055209 12.4737132456699 12.7916290186635 13.109565585441 13.4275213414455 13.7454948431824 14.0634847884921 14.3814899996548 14.6995094088628 15.0175420456841 15.3355870262037 15.6536435435869 15.9717108598527 16.2897882986785 16.6078752390897 16.9259711099087 pi = 3.14159265; alf = (n - 2) * 180 / (2 * n); ans = 1. + 1. / cos((alf * pi) / 180); cout << ans; 1+sqrt(2) Edited by author 26.06.2015 05:22 please write the 5 test. I got wrong answer It must be N=10; But i dont know answer for N=10 Epsilon... Precision... Who cares, huh? Edited by author 19.10.2013 21:33 Thanks Leonid I should learn to pay attention! What is the solution for n = 10? Dmitriy, remember that the sum of angles of regular polygon is 180(n-2), where n is the number of it's angles. The radius of circle is the half of polygon's diagonal + 1.0. So the answer is 1.0/cos(pi*(n-2)/(2*n))+1.0, exceptions is 1, R will be 1. And don't forget about precision it must be at least 6 digits. If you still are having problems with it look at this: https://github.com/oybek/timus/blob/master/1984.cppThaks) Edited by author 16.12.2013 23:45 Edited by author 16.12.2013 23:45 1/sin(M_PI/n)+1 (except 1 and 2), but the real problem with WA5 is that cout does not work while printf("%.7f\n", a) does. Thanks!!! Java version: double res = N < 3 ? N : 1 / Math.sin(Math.PI / N) + 1; System.out.println(res); For n = 7 We can solve it only with circle of radius 3. However, we send the solution, which prints more than 3. Link to the picture - https://www.dropbox.com/s/s2hqzmyo47la0zd/Clar.pngPlease, correct the tests, or provide the reason this solution is wrong. Have you READ the problem before submitting it? Statement is more than clear: "At first you want to draw a circle and place all your bottles inside it so that *each* of the bottle bottoms *touches* the circle" I fully agree with you, with 7 and 6 bottles the answer should be 3 and my program give me more than 3 for 7 bottles but the judge accept it, that's wrong or why not? Oh yea! I also solved a circle packing problem at the beginning :) But the problem is much more easier. This cost me a lot of contest time... Edited by author 29.10.2013 00:21 "Circle" generally means «окружность», not «круг». English term for «круг» is actually "disk"/"disc". Don't let Google Translate confuse you on this matter! I cant find my mistake please help me what is test 5. Edited by author 19.10.2013 17:12 |
|
|