10286 - Trouble with a Pentagon

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

Post Reply
Almost Human
Learning poster
Posts: 93
Joined: Sun Jan 12, 2003 3:30 pm

10286 - Trouble with a Pentagon

Post by Almost Human »

What are we looking for actually ???

can I use the height of the pentagon to define the side length ???

code :

Code: Select all

#include <math.h>
#include <stdio.h>

int main ( void )
{
	long double s , output , pi = 3.1415926535897932384626433832795 ;

/*	freopen ( "10286.in" , "r" , stdin ) ;
	freopen ( "10286.out" , "w" , stdout ) ;*/

	while ( scanf ( "%Lf" , &s ) != EOF )
	{
		output = ( s * sin ( 36 * pi / 180 ) + s * cos ( 18 * pi / 180 ) ) / sqrt ( 2 ) ;

		printf ( "%.10Lf\n" , output ) ;
	}

	return 0 ;
}
hujialie
New poster
Posts: 43
Joined: Thu Apr 17, 2003 10:24 am
Location: Shanghai,China

Post by hujialie »

To Almost Human:

You should notice that the low point of the square is a bit higher than the
horizontal line,so you can't calculate the diagonal of the square by the height of pentagon and,of course ,the side of square.

Try to solve it from another angle----using sine theorem(I am not sure whether it should say so),i.e.,the theorem pointing out the relationship between the edge and angle of a triangle.

If you want some test data,mailto me.
Good luck. :)
Retired from SJTU Accelerator 2004
anupam
A great helper
Posts: 405
Joined: Wed Aug 28, 2002 6:45 pm
Contact:

Post by anupam »

Would you please leave a bit more discussion to solve the problem?
Anupam
"Everything should be made simple, but not always simpler"
Raiyan Kamal
Experienced poster
Posts: 106
Joined: Thu Jan 29, 2004 12:07 pm
Location: Bangladesh
Contact:

Post by Raiyan Kamal »

This problem can be solved without taking the height in concideration. Think about the triangle that is formed when the prntagon is touching the two adjacent sides of the sqr.

Dear Anupam bhai, sine rule ( as we were taught in school ) can be used to solve this
anupam
A great helper
Posts: 405
Joined: Wed Aug 28, 2002 6:45 pm
Contact:

Post by anupam »

Ha ha,
this is the ever smallest program from me (just 2 lines).
Thanks Raiyan Kamal. Sometimes, very easy problem seems tough to me.
Thanks again.
"Everything should be made simple, but not always simpler"
stcheung
Experienced poster
Posts: 114
Joined: Mon Nov 18, 2002 6:48 am
Contact:

Re: 10286 - Trouble with Pentagon

Post by stcheung »

Isn't the answer of the form F * sin(a) / sin (b)?

I calculated values for a & b, but the result is different from output. I then used brute-force to come up with values for (a, b) that would yield sample output, but these all got me WA. Any idea? Can somone provide more output? Thanks.
sefakilic
New poster
Posts: 7
Joined: Wed Mar 11, 2009 8:12 pm

Re: 10286 - Trouble with Pentagon

Post by sefakilic »

Hello,

I am getting Presentation Error.
What can be the reason?

Code: Select all

REMOVED
Thanks.

edit: It seems ACCEPTED now. :s

-- sefa kilic
Asma_ju
New poster
Posts: 4
Joined: Sat Jun 11, 2011 9:20 am

Re: 10286 - Trouble with Pentagon

Post by Asma_ju »

Code: Select all

sside=pside/sin(108*PI/180);
        cout<<setprecision(10)<<fixed<<sside<<endl;
Is this logic correct?
If wrong may anyone can give some idea or test case?
Post Reply

Return to “Volume 102 (10200-10299)”