utd bob competition over

This commit is contained in:
2026-04-18 16:02:31 -05:00
parent 3936b37e29
commit ee7b6b1581
3 changed files with 97 additions and 25 deletions

View File

@@ -0,0 +1,52 @@
// General imports
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
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;
}
}