utd bob competition over
This commit is contained in:
52
solutions/battle-of-the-brains-2026/DontTestMe.java
Normal file
52
solutions/battle-of-the-brains-2026/DontTestMe.java
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,31 @@
|
||||
// General imports
|
||||
|
||||
import java.util.Scanner;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
public class MaximumAura {
|
||||
public static void main(String[] args) {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
||||
long t = System.nanoTime();
|
||||
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
||||
PrintWriter out = new PrintWriter(System.out);
|
||||
|
||||
// Write code here
|
||||
|
||||
int a = sc.nextInt();
|
||||
int a = Integer.parseInt(br.readLine());
|
||||
int[] input = new int[a];
|
||||
int[] left = new int[a];
|
||||
int[] right = new int[a];
|
||||
left[0] = 1;
|
||||
right[a - 1] = 1;
|
||||
StringTokenizer st = new StringTokenizer(br.readLine());
|
||||
for (int i = 0; i < a; i++) {
|
||||
input[i] =sc.nextInt();
|
||||
|
||||
input[i] = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
|
||||
for (int i = 1; i < input.length; i++) {
|
||||
@@ -39,12 +48,14 @@ public class MaximumAura {
|
||||
}
|
||||
right[i] += max;
|
||||
}
|
||||
|
||||
|
||||
PriorityQueue<Integer> p = new PriorityQueue<>();
|
||||
for (int i = 0; i < input.length; i++) {
|
||||
System.out.print((left[i]+right[i]-1)+" ");
|
||||
out.print((left[i] + right[i] - 1) + " ");
|
||||
}
|
||||
|
||||
sc.close();
|
||||
|
||||
br.close();
|
||||
out.flush();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
// General imports
|
||||
|
||||
import java.util.Scanner;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
public class WeightedDifference {
|
||||
public static void main(String[] args) {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
public static void main(String[] args) throws IOException{
|
||||
|
||||
double t = System.currentTimeMillis();
|
||||
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
||||
|
||||
|
||||
// Write code here
|
||||
|
||||
int a = sc.nextInt();
|
||||
int a = Integer.parseInt(br.readLine());
|
||||
StringTokenizer st = new StringTokenizer(br.readLine());
|
||||
int[] ar = new int[a];
|
||||
for (int i = 0; i < a; i++) {
|
||||
ar[i] = sc.nextInt();
|
||||
ar[i] = Integer.parseInt(st.nextToken());
|
||||
}
|
||||
|
||||
long max = Long.MIN_VALUE;
|
||||
@@ -34,7 +42,8 @@ public class WeightedDifference {
|
||||
}
|
||||
|
||||
System.out.println(max);
|
||||
sc.close();
|
||||
System.out.println(System.currentTimeMillis()-t);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user