|
|
back to boardCommon BoardRope 1020 to all the people that got accept. Ok I think 1020 is really simple problem, but I keep getting W.A. . I use arctan to obtain the angle between every three adjacent vertices. When i get the angle i set it to pi - the angle and measure the partition of the circle with r * (the angle).After i get all the partitions i add them and add all the distances between every 2 adjacent vertices.I handle the n=1 case with writing 2*pi*r and the n = 2 with writing 2*the distance + 2*pi*r.Also i want to ask if i have the number 10.446 I should output 10.45 ie write(smth:0:2) or 10.44.I had created a convex generating program to debug.Here are some sample inputs(i used write(smth:0:2): sample 1 8 5 12 23 42 25 78 43 83 55 81 69 32 73 5 68 6 49 result1 251.21 sample2 7 5 3 1 80 31 92 42 87 94 64 99 11 96 5 59 result2 354.71 sample3 6 5 30 0 72 11 95 29 84 92 9 89 1 29 result3 344.59 Re: Rope 1020 to all the people that got accept. no need to compute the angels, just sum up all the distance between to adjust points,and add 2*pi*r to the sum,you get the correct answer. Re: Rope 1020 to all the people that got accept. > Ok I think 1020 is really simple problem, but I keep > getting W.A. . I use arctan to obtain the angle between > every three adjacent vertices. When i get the angle i set > it to pi - the angle and measure the partition of the > circle with r * (the angle).After i get all the partitions > i add them and add all the distances between every 2 > adjacent vertices.I handle the n=1 case with writing 2*pi*r > and the n = 2 with writing 2*the distance + 2*pi*r.Also i > want to ask if i have the number 10.446 I should output > 10.45 ie write(smth:0:2) or 10.44.I had created a convex > generating program to debug.Here are some sample inputs(i > used write(smth:0:2): > sample 1 > 8 5 > 12 23 > 42 25 > 78 43 > 83 55 > 81 69 > 32 73 > 5 68 > 6 49 > result1 > 251.21 > sample2 > 7 5 > 3 1 > 80 31 > 92 42 > 87 94 > 64 99 > 11 96 > 5 59 > result2 > 354.71 > sample3 > 6 5 > 30 0 > 72 11 > 95 29 > 84 92 > 9 89 > 1 29 > result3 > 344.59 > I wrote {l:Extended;} l:=2*Pi*R + SumOfAllDistancesBetweenTheCenters; Write(l:0:2); I got accept Excuse me for my English Re: Rope 1020 to all the people that got accept. > Ok I think 1020 is really simple problem, but I keep
No, it's simpler ;-) -- this stuff - arctan etc. is not needed. my source code is nearly 100-200 bytes and the task can be solved with just a little bit of maths. and by the way, my arc tan and cosine theorem stuff had wrong answer - probably caused by some rounding errs
|
|
|