-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCircleOfWinter.java
67 lines (50 loc) · 1.39 KB
/
CircleOfWinter.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import java.util.*;
import java.io.*;
public class CircleOfWinter
{
public static void main(String[] argv) {
Scanner in = new Scanner(System.in).useLocale(Locale.US);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
/* int xl = Integer.MAX_VALUE;
int xr = Integer.MIN_VALUE;
int yt = Integer.MIN_VALUE;
int yb = Integer.MAX_VALUE;
*/
double mDist = Double.MIN_VALUE;
int fx;
int fy;
while (n-- > 0) {
int x = in.nextInt();
int y = in.nextInt();
/* if (x < xl)
xl=x;
if (x > xr)
xr=x;
if (y < yb)
yb=y;
if (y > yt)
yt=y;
*/
double d= Math.sqrt(x*x + y*y);
if (d > mDist) {
mDist=d;
fx=x;
fy=y;
}
}
/* double xc = (xl+xr)/2.0;
double yc = (yt+yb)/2.0;
double dx = xc - xl;
double dy = yc - yb;
double r = Math.sqrt(dx*dx + dy*dy);
*/
warn ("0.0 0.0 "+mDist);
}
public static final boolean DEBUG = true;
public static void warn(String s) {
if (DEBUG) {
System.out.println(s);
}
}
}