Submission #1955454


Source Code Expand

import java.util.Arrays;
import java.util.Scanner;

class Main {

	void run() {
		Scanner sc = new Scanner(System.in);
		double[][] p = new double[3][2];
		for (int i = 0; i < 3; ++i) {
			p[i][0] = sc.nextDouble();
			p[i][1] = sc.nextDouble();
		}
		p[1][0] -= p[0][0];
		p[1][1] -= p[0][1];
		p[2][0] -= p[0][0];
		p[2][1] -= p[0][1];
		double a = dist(p[1]);
		double b = dist(p[2]);
		double c = dist(new double[] { p[1][0] - p[2][0], p[1][1] - p[2][1] });
		double s = 0.5
				* Math.sqrt(dist(p[1]) * dist(p[1]) * dist(p[2]) * dist(p[2]) - dot(p[1], p[2]) * dot(p[1], p[2]));
		double r = 2 * s / (a + b + c);
		double d = Math.max(a, Math.max(b, c));
		System.out.println(d * r / (2 * r + d));
	}

	double dist(double[] p) {
		double x = p[0];
		double y = p[1];
		return Math.sqrt(x * x + y * y);
	}

	double dot(double[] p1, double[] p2) {
		return p1[0] * p2[0] + p1[1] * p2[1];
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Submission Info

Submission Time
Task B - Inscribed Bicycle
User fortoobye
Language Java8 (OpenJDK 1.8.0)
Score 500
Code Size 1089 Byte
Status AC
Exec Time 116 ms
Memory 24016 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 18
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 116 ms 20560 KB
001.txt AC 106 ms 22612 KB
002.txt AC 104 ms 24016 KB
003.txt AC 104 ms 21204 KB
004.txt AC 104 ms 20176 KB
005.txt AC 104 ms 22100 KB
006.txt AC 103 ms 20180 KB
007.txt AC 104 ms 21204 KB
008.txt AC 111 ms 19924 KB
009.txt AC 105 ms 20308 KB
010.txt AC 104 ms 22356 KB
011.txt AC 105 ms 19284 KB
012.txt AC 104 ms 22612 KB
013.txt AC 114 ms 20180 KB
014.txt AC 105 ms 22228 KB
015.txt AC 106 ms 20180 KB
example0.txt AC 105 ms 18508 KB
example1.txt AC 105 ms 21204 KB