comments for bob solutions
This commit is contained in:
@@ -6,8 +6,9 @@ import java.io.InputStreamReader;
|
||||
import java.util.Arrays;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
public class DontTestMe {
|
||||
public static void main(String[] args) throws IOException{
|
||||
//Incomplete Not Working
|
||||
public class DontTestMe {
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
||||
|
||||
@@ -15,38 +16,36 @@ public class DontTestMe {
|
||||
int N = Integer.parseInt(st.nextToken());
|
||||
int H = Integer.parseInt(st.nextToken());
|
||||
Test[] ar = new Test[N];
|
||||
for (int i =0; i < N; i++){
|
||||
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()));
|
||||
ar[i] = new Test(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()),
|
||||
Double.parseDouble(st.nextToken()));
|
||||
}
|
||||
|
||||
Arrays.sort(ar, (a1,a2) -> a1.compareTo(a2));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Arrays.sort(ar, (a1, a2) -> a1.compareTo(a2));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Test{
|
||||
int hours,points;
|
||||
class Test {
|
||||
int hours, points;
|
||||
double percent;
|
||||
double weight;
|
||||
|
||||
public Test (int h, int p, double per){
|
||||
public Test(int h, int p, double per) {
|
||||
hours = h;
|
||||
points = p;
|
||||
percent = per;
|
||||
weight = 1/(double) hours * points * percent;
|
||||
weight = 1 / (double) hours * points * percent;
|
||||
}
|
||||
|
||||
public int compareTo(Object o){
|
||||
public int compareTo(Object o) {
|
||||
Test t = (Test) o;
|
||||
if (this.weight > t.weight) return 1;
|
||||
else if (this.weight < t.weight) return -1;
|
||||
if (this.weight > t.weight)
|
||||
return 1;
|
||||
else if (this.weight < t.weight)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user