10289 - A Square and Equilateral Triangles

All about problems in Volume 102. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

htl
Experienced poster
Posts: 185
Joined: Fri Jun 28, 2002 12:05 pm
Location: Taipei, Taiwan

Post by htl »

The value I calculated is the same as cooleye's but I got WA. But Scott's value could get AC. Could someone explain it?
shanto86
Experienced poster
Posts: 160
Joined: Wed Jul 30, 2003 8:10 pm

Wrong picture of five triangles

Post by shanto86 »

Hi to all.
It is my first writing in this E-Board.

The picture for the 5 triangles, given with the problem by judge is wrong. at first I calculated assuming that the position of upper left triangle correct (assuming that it is inclined with the upper side of square). But not. The position of the lower left triangle is correct. And if you assume this and calculate this you will get AC.

But you can rotate these two triangles and in that case there might be some gap with other triangles. So the answer is not correct. Hope I could convince all to you.

So for the fifth picture side = s*(2 + sqrt(3)) / (5 + sqrt(3)).

I think the judge should change the picture so that others do not fell in this problem. The main object of a problem is to taste ones knowledge not to deceive him.
:evil:
Self judging is the best judging!
Rocky
Experienced poster
Posts: 124
Joined: Thu Oct 14, 2004 9:05 am

10289

Post by Rocky »

Can Any Body Help Me With Some I/o For The Problem 10289
I Think I Got Some Problem With Precission
PLEASE Help Me.

Thank's In Advance
Rocky
Antonio Ocampo
Experienced poster
Posts: 131
Joined: Sat Jul 17, 2004 4:09 am
Location: Lima, Per

Post by Antonio Ocampo »

Hi Rocky.

Try this

Input

Code: Select all

10000.000
10000
0.0000001
0.1000212
0.0000000
0
7651.6712
982.8723
34.534
853.943223
8543.123
76345.7542
757.352
4523.6
523.423
Output

Code: Select all

10352.7618041008 8164.9658092773 6764.0791490305 6339.7459621556 5543.7056466848 5257.8342306321 4766.2710943897
10352.7618041008 8164.9658092773 6764.0791490305 6339.7459621556 5543.7056466848 5257.8342306321 4766.2710943897
0.0000001035 0.0000000816 0.0000000676 0.0000000634 0.0000000554 0.0000000526 0.0000000477
0.1035495659 0.0816669678 0.0676551313 0.0634108999 0.0554488091 0.0525894889 0.0476728154
0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000
0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000 0.0000000000
7921.5929336898 6247.5633731831 5175.6509619157 4850.9651593942 4241.8612838016 4023.1218756902 3646.9939264334
1017.5442805749 802.5118724386 664.8226030590 623.1160695240 544.8754719480 516.7779623280 468.4635832966
35.7522276143 28.1968929258 23.3590709333 21.8936787057 19.1446330803 18.1574047321 16.4598405974
884.0670781945 697.2417218859 577.6139549150 541.3783099924 473.4009867293 448.9891908906 407.0124900035
8844.4917482135 6975.4307199450 5778.6360151903 5416.1229543449 4736.0559215423 4491.8324545900 4071.8840210716
79038.9407987030 62336.0472726486 51640.8724101229 48401.2686917175 42323.8388658952 40141.3319796183 36388.4561422842
784.0684857859 618.3753185588 512.2788871677 480.1419283930 419.8536558928 398.2031270238 360.9744945878
4683.1753297031 3693.5039334847 3059.7988438554 2867.8474834407 2507.7506863344 2378.4338925687 2156.0703922581
541.8873641788 427.3730898789 354.0474600423 331.8368850749 290.1703040705 275.2071366500 249.4775915039
Hope it helps :wink:
jurajz
Learning poster
Posts: 69
Joined: Sat Sep 02, 2006 7:30 pm
Location: Slovakia

10289 rejudge

Post by jurajz »

Hello!

I have problem with 10289. This problem was rejudged. Before rejudge, I solved this problem successful with first submit. But after rejudge I have WA. I tried add to t1..t7 small value (1e-12; 1e-15), but still WA... Please: can someone explain, where may be a problem? I coded it in Pascal - should I code it in C/C++? Or something else...?

Thanks!

(please sorry for my bad english)
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey »

The case with 5 triangles was not optimal, so you must re-examine your calculations for this case if you previously got accepted. Hint: the topmost right triangle is slightly left of the bottommost right triangle. I couldn't find a direct analytical method so I used an iterative numerical method.
hannderson
New poster
Posts: 1
Joined: Thu Jul 31, 2014 2:03 am

Re: 10289 - A Square & Equilateral Triangles

Post by hannderson »

all the tests I did, worked well.
But I am getting wrong answer, anyone know where I am going wrong? :oops:

Code: Select all

        a = n/(sin((75*pi)/180));
        b=n/sin((120*pi)/180)*sin((45*pi)/180);
        c=n*sqrt(2)/sqrt(3)*2/(1+sqrt(2));
        d=n*sqrt(3)/(1+sqrt(3));
        e=n*(2 + sqrt(3)) / (5 + sqrt(3));
        f=n*(sqrt(3)+3)/9;
        g=n*(sqrt(3)+1)/(4+sqrt(3));
 
        printf("%.10Lf %.10Lf %.10Lf %.10Lf %.10Lf %.10Lf %.10Lf\n",a,b,c,d,e,f,g);
i am using pi as

Code: Select all

# define pi          3.141592653589793238462643383279502884L 
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10289 - A Square & Equilateral Triangles

Post by brianfry713 »

Post your full code. I solved it using double and M_PI. Your formula for t5 is wrong. See the post before yours.
Check input and AC output for thousands of problems on uDebug!
LCSFC
New poster
Posts: 10
Joined: Fri Aug 01, 2014 2:39 pm

Re: 10289 - A Square & Equilateral Triangles

Post by LCSFC »

Hi guys... i have to solve this problem for our training to a contest in Brazil... i got that formula for t5 ( sqrt(3) + 2 / sqrt(3) + 5) but after i saw previous messages , people said it's wrong. Can somebody explain me why please? I couldn't understand that ideas before about the 5 case not optimal... thanks.
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10289 - A Square & Equilateral Triangles

Post by brianfry713 »

(2.0 + sqrt(3)) / (5.0 + sqrt(3)) = 0.554, the correct answer is 0.555
Check input and AC output for thousands of problems on uDebug!
LCSFC
New poster
Posts: 10
Joined: Fri Aug 01, 2014 2:39 pm

Re: 10289 - A Square & Equilateral Triangles

Post by LCSFC »

but is it necessary to use some numerical method to get this 0.555? All the geometry i did arrive in 0.554, is the picture for case 5 wrong? Are the heights of the uppermost and bottommost triangle same axis?
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10289 - A Square & Equilateral Triangles

Post by brianfry713 »

Image
Point A is on the right edge of the square, at the same height as the top of the bottom center triangle.
Point B is the bottom right of the right triangle.
Point C is the left of the right triangle.
Point D is the top of the right triangle.
Point E is the bottom of the top center triangle.
Point F is the left of the left triangles.
Point G is the top of the bottom center triangle.

I am measuring (x = horizontal distance from the left of the square, y = vertical distance from the bottom of the square)
I solved for t5 using a binary search. First I set S equal to 1.0
Point G is at (t5, sqrt(3.0) * t5 / 2.0)
Point E is 0.0014 to the left of point G.
Point A is at (1.0, sqrt(3.0) * t5 / 2.0)
Point F is at (0.0, sqrt(3.0) * t5 / 2.0)
First solve for dAG = distance from A to G, then dAB. You can now find the coordinates of B, C, and D.
Using the circle equation, line equation, and quadratic formula, find the point E which is distance t5 from F along the line from C to D.
If Ey plus the height of the triangle is greater than 1.0, then lower the upper limit, otherwise raise the lower limit.
Check input and AC output for thousands of problems on uDebug!
LCSFC
New poster
Posts: 10
Joined: Fri Aug 01, 2014 2:39 pm

Re: 10289 - A Square & Equilateral Triangles

Post by LCSFC »

Thank you brianfry. I will try this problem again using numerical ideas, this drawing helped me to understand the figure, the upper triangle is not aligned to the bottom, and this turned the problem to be very hard hehehehe. :)
Post Reply

Return to “Volume 102 (10200-10299)”