Johnny5b's picture
download
raw
1.01 kB
public class Triangle {
public enum TriangleType {
INVALID, SCALENE, EQUALATERAL, ISOCELES
}
public static TriangleType classifyTriangle(int a, int b, int c) {
delay();
// Sort the sides so that a <= b <= c
if (a > b) {
int tmp = a;
a = b;
b = tmp;
}
if (a > c) {
int tmp = a;
a = c;
c = tmp;
}
if (b > c) {
int tmp = b;
b = c;
c = tmp;
}
if (a + b <= c) {
return TriangleType.INVALID;
} else if (a == b && b == c) {
return TriangleType.EQUALATERAL;
} else if (a == b || b == c) {
return TriangleType.ISOCELES;
} else {
return TriangleType.SCALENE;
}
}
private static void delay() {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// do nothing
}
}
}

Xet Storage Details

Size:
1.01 kB
·
Xet hash:
2c3b5ab95bb07c03a4e08dfb9406e623072020887c99c404031d28a31d8ae34e

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.