52 lines
1.2 KiB
Java
52 lines
1.2 KiB
Java
// General imports
|
|
|
|
import java.io.BufferedReader;
|
|
import java.io.IOException;
|
|
import java.io.InputStreamReader;
|
|
import java.util.Arrays;
|
|
import java.util.StringTokenizer;
|
|
|
|
//Incomplete Not Working
|
|
public class DontTestMe {
|
|
public static void main(String[] args) throws IOException {
|
|
|
|
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
|
|
|
StringTokenizer st = new StringTokenizer(br.readLine());
|
|
int N = Integer.parseInt(st.nextToken());
|
|
int H = Integer.parseInt(st.nextToken());
|
|
Test[] ar = new Test[N];
|
|
for (int i = 0; i < N; i++) {
|
|
st = new StringTokenizer(br.readLine());
|
|
ar[i] = new Test(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()),
|
|
Double.parseDouble(st.nextToken()));
|
|
}
|
|
|
|
Arrays.sort(ar, (a1, a2) -> a1.compareTo(a2));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
class Test {
|
|
int hours, points;
|
|
double percent;
|
|
double weight;
|
|
|
|
public Test(int h, int p, double per) {
|
|
hours = h;
|
|
points = p;
|
|
percent = per;
|
|
weight = 1 / (double) hours * points * percent;
|
|
}
|
|
|
|
public int compareTo(Object o) {
|
|
Test t = (Test) o;
|
|
if (this.weight > t.weight)
|
|
return 1;
|
|
else if (this.weight < t.weight)
|
|
return -1;
|
|
return 0;
|
|
}
|
|
}
|