Submission #1084755
Source Code Expand
#include <bits/stdc++.h> using namespace std; typedef long long lint; typedef pair<int, int> pi; const int mod = 1e9 + 7; pi a[3]; double AB, BC, CA; double angA, angB, angC; bool trial(double v){ if(AB - v / tan(angA/2) - v / tan(angB/2) >= 2 * v) return 1; if(BC - v / tan(angB/2) - v / tan(angC/2) >= 2 * v) return 1; if(CA - v / tan(angC/2) - v / tan(angA/2) >= 2 * v) return 1; return 0; } int main(){ for(int i=0; i<3; i++){ cin >> a[i].first >> a[i].second; } AB = hypot(a[1].first - a[0].first, a[1].second - a[0].second); BC = hypot(a[2].first - a[1].first, a[2].second - a[1].second); CA = hypot(a[0].first - a[2].first, a[0].second - a[2].second); angA = acos((AB * AB + CA * CA - BC * BC) / (2 * AB * CA)); angB = acos((BC * BC + AB * AB - CA * CA) / (2 * BC * AB)); angC = acos((CA * CA + BC * BC - AB * AB) / (2 * CA * BC)); double s = 0, e = 1000; for(int i=0; i<100; i++){ double m = (s+e)/2; if(trial(m)) s = m; else e = m; } printf("%.15f\n", s); }
Submission Info
Submission Time | |
---|---|
Task | B - Inscribed Bicycle |
User | koosaga |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 1031 Byte |
Status | AC |
Exec Time | 6 ms |
Memory | 512 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 | 6 ms | 512 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 |