Submission #3062930
Source Code Expand
#define _USR_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;
#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ld x[3];
ld y[3];
ld a[3];
ld dist[3];
ld angle[3];
ld caldist(ll index1, ll index2){
return sqrt((x[index1] -x[index2])*(x[index1] - x[index2]) + (y[index1] - y[index2])*(y[index1]-y[index2]));
}
void inp(){
rep(i,3){
cin >> x[i] >> y[i] ;
}
rep(i,3){
dist[i] = caldist((i+1)%3, (i+2)%3);
}
angle[0] = acos((pow(dist[1], 2) + pow(dist[2], 2) - pow(dist[0],2))/(2.0*dist[1] * dist[2]));
angle[1] = acos((pow(dist[2], 2) + pow(dist[0], 2) - pow(dist[1],2))/(2.0*dist[2] * dist[0]));
angle[2] = acos((pow(dist[0], 2) + pow(dist[1], 2) - pow(dist[2],2))/(2.0*dist[0] * dist[1]));
rep(i,3){
angle[i] = acos(
(
pow(dist[(i+1)%3],2)
+pow(dist[(i+2)%3],2)
-pow(dist[i],2)
)
/
(
2.0 * dist[(i+1)%3] * dist[(i+2)%3]
)
);
angle[i] *= 0.5;
}
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
inp();
ld ans = 0.0;
rep(i, 3){
ld ret = 1/tan(angle[(i+1)%3]) + 1/ tan( angle[(i+2)%3] ) + 2;
ret = dist[i] / ret;
ans = max(ret, ans);
}
cout << fixed << setprecision(16) << ans << endl;
//cout << fixed << setprecision(16) << ans << endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
B - Inscribed Bicycle |
User |
ukohank517 |
Language |
C++14 (GCC 5.4.1) |
Score |
500 |
Code Size |
2691 Byte |
Status |
AC |
Exec Time |
1 ms |
Memory |
384 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
500 / 500 |
Status |
|
|
Set Name |
Test Cases |
Sample |
example0.txt, example1.txt |
All |
000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, example0.txt, example1.txt |
Case Name |
Status |
Exec Time |
Memory |
000.txt |
AC |
1 ms |
384 KB |
001.txt |
AC |
1 ms |
256 KB |
002.txt |
AC |
1 ms |
256 KB |
003.txt |
AC |
1 ms |
256 KB |
004.txt |
AC |
1 ms |
256 KB |
005.txt |
AC |
1 ms |
256 KB |
006.txt |
AC |
1 ms |
256 KB |
007.txt |
AC |
1 ms |
256 KB |
008.txt |
AC |
1 ms |
256 KB |
009.txt |
AC |
1 ms |
256 KB |
010.txt |
AC |
1 ms |
256 KB |
011.txt |
AC |
1 ms |
256 KB |
012.txt |
AC |
1 ms |
256 KB |
013.txt |
AC |
1 ms |
256 KB |
014.txt |
AC |
1 ms |
256 KB |
015.txt |
AC |
1 ms |
256 KB |
example0.txt |
AC |
1 ms |
256 KB |
example1.txt |
AC |
1 ms |
256 KB |