Submission #1023498
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;
const int N = 3;
double dist(pair<double,double>& a,pair<double,double>& b)
{
return sqrt((a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second));
}
double f(double m,double r,double mx)
{
return mx * m / r + 2 * m;
}
int main()
{
vector< pair<double,double> > P(N);
FOR(i,0,N){
scanf("%lf%lf",&P [i].first,&P [i].second);
}
double a = dist(P [0],P [1]),b = dist(P [1],P [2]),c = dist(P [2],P [0]);
double s = sqrt((a + b + c) * (b + c - a) * (a + c - b) * (a + b - c)) / 4.0;
double r = s / (a + b + c) * 2;
double lo = 0.0,hi = r,mid;
FOR(i,0,100){
mid = (lo + hi) / 2.0;
if(f(mid,r,max({a,b,c})) <= max({a,b,c})){
lo = mid;
}
else{
hi = mid;
}
}
printf("%.10f\n",(lo + hi) / 2.0);
return 0;
}
Submission Info
Submission Time
2016-12-13 16:47:57+0900
Task
B - Inscribed Bicycle
User
gigime
Language
C++14 (GCC 5.4.1)
Score
500
Code Size
1143 Byte
Status
AC
Exec Time
3 ms
Memory
256 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:26:45: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lf%lf",&P [i].first,&P [i].second);
^
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
3 ms
256 KB
001.txt
AC
3 ms
256 KB
002.txt
AC
3 ms
256 KB
003.txt
AC
3 ms
256 KB
004.txt
AC
3 ms
256 KB
005.txt
AC
3 ms
256 KB
006.txt
AC
3 ms
256 KB
007.txt
AC
3 ms
256 KB
008.txt
AC
3 ms
256 KB
009.txt
AC
3 ms
256 KB
010.txt
AC
3 ms
256 KB
011.txt
AC
3 ms
256 KB
012.txt
AC
3 ms
256 KB
013.txt
AC
3 ms
256 KB
014.txt
AC
3 ms
256 KB
015.txt
AC
3 ms
256 KB
example0.txt
AC
3 ms
256 KB
example1.txt
AC
3 ms
256 KB