Submission #3916143

Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;

typedef long double Double;
typedef vector<int> vi;

#define rep(var,n)  for(int var=0;var<(n);++var)
#define ALL(c)  (c).begin(),(c).end()


double solve(vi& x, vi& y){
    vector<double> a(3);
    rep(i,3) {
        a[i] = hypot(y[(i+1)%3]-y[i], x[(i+1)%3]-x[i]);
    }
    sort(ALL(a));
    double s = accumulate(ALL(a), 0.0) / 2;
    double area = sqrt(s * (s-a[0]) * (s-a[1]) * (s-a[2]));
    double h = area * 2 / a[2];
    
    double r = area / (s+h);
    return r;
}

int main() {
    vi x(3), y(3);
    rep(i,3) {
        scanf("%d%d", &x[i], &y[i]);
    }
    printf("%.12f\n", solve(x,y));
    return 0;
}

Submission Info

Submission Time
Task B - Inscribed Bicycle
User naoya_t
Language C++14 (GCC 5.4.1)
Score 500
Code Size 695 Byte
Status
Exec Time 1 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:28:36: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &x[i], &y[i]);
                                    ^

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 example0.txt, example1.txt
All 500 / 500 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 1 ms 256 KB
001.txt 1 ms 256 KB
002.txt 1 ms 256 KB
003.txt 1 ms 256 KB
004.txt 1 ms 256 KB
005.txt 1 ms 256 KB
006.txt 1 ms 256 KB
007.txt 1 ms 256 KB
008.txt 1 ms 256 KB
009.txt 1 ms 256 KB
010.txt 1 ms 256 KB
011.txt 1 ms 256 KB
012.txt 1 ms 256 KB
013.txt 1 ms 256 KB
014.txt 1 ms 256 KB
015.txt 1 ms 256 KB
example0.txt 1 ms 256 KB
example1.txt 1 ms 256 KB