Help, Can't understand why this approach is giving WA

Revision en1, by Ferrarixxx, 2020-05-29 11:48:11

Hi Guys,
The above picture shows my approach for this problem https://codeforces.me/contest/1354/problem/C1

Am basically using the interior angle subtended by 3 adjacent vertices and then to find the vertical ( perpendicular ) line's length using tan function
But am getting completely unexpected answer.

// -- MY CODE :


long double n;

cin >> n;

// long double angle = (((180 * (2*n — 2)) / (2*n) ) / 360) * 2 * 3.14

long double angle = ((((n — 1)) / n)) * 3.14;

cout << tan(angle) << endl;


PLEASE GUYS HELP ME FIND MY MISTAKE .
THANKS IN ADVANCE.

Tags #help, #general, #problem c, #easy

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Ferrarixxx 2020-05-29 11:48:11 918 Initial revision (published)