Monday 28 November 2016

UCV2013I Spoj

Logic :

     For this problem only a image is enough to understand logic. 
     Which is



Source: Click Here

now we can apply sine formula to find solution.



Below you can see code also: 

#include <iostream>

#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
/////////////////////////////////////////////////////////////////////


int main()
{
while(true) {
double r;
double N;
scanf("%lf%lf", &r, &N);
if(r <= 0 || N <= 0) break;

printf("%.2lf\n", r/sin((acos(-1) * 0.5) / N));
}
    return 0;
}


Happy Coding :)


1 comment:

  1. JM Hospitality, Las Vegas - MOHEGAN HOCKEY
    › hotel-las-vegas › 인천광역 출장마사지 hotel-las-vegas Mohegan Gaming 나주 출장샵 & Entertainment has unveiled 나주 출장안마 an exclusive resort, Mohegan Sun. This resort 강원도 출장마사지 features a 20,000 square-foot 순천 출장마사지 gaming area and 11,000 square-foot

    ReplyDelete