QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#24255 | #2291. Lopsided Lineup | jskop | Compile Error | / | / | Java8 | 786b | 2022-03-28 20:43:34 | 2022-05-18 04:15:49 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-05-18 04:15:49]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-03-28 20:43:34]
- 提交
answer
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Solution
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String line = "";
ArrayList<String> lines = new ArrayList<String>();
ArrayList<int> sums = new ArrayList<int>();
while(line!=null) {
line = reader.readLine();
}
int players = Integer.parseInt(lines.get(0));
for(int i=0; i<players; i++) {
int sum = 0;
for(String s: lines.get(i).split(" ")) {
sum += Integer.parseInt(s);
}
sums.add(sum);
}
Collections.sort(sums);
var max = 0;
var min = 0;
for(int i=0; i<players/2; i++) {
max += sums.get(players-i-1);
min += sums.get(i);
}
System.out.println((max-min)/2);
}
Details
Solution.java:13: error: illegal start of type while(line!=null) { ^ Solution.java:13: error: <identifier> expected while(line!=null) { ^ Solution.java:13: error: ';' expected while(line!=null) { ^ Solution.java:13: error: illegal start of type while(line!=null) { ^ Solution.java:13: error: <identifier> expected while(line!=null) { ^ Solution.java:13: error: ';' expected while(line!=null) { ^ Solution.java:14: error: illegal start of type line = reader.readLine(); ^ Solution.java:14: error: ';' expected line = reader.readLine(); ^ Solution.java:14: error: invalid method declaration; return type required line = reader.readLine(); ^ Solution.java:16: error: class, interface, or enum expected int players = Integer.parseInt(lines.get(0)); ^ Solution.java:17: error: class, interface, or enum expected for(int i=0; i<players; i++) { ^ Solution.java:17: error: class, interface, or enum expected for(int i=0; i<players; i++) { ^ Solution.java:17: error: class, interface, or enum expected for(int i=0; i<players; i++) { ^ Solution.java:19: error: class, interface, or enum expected for(String s: lines.get(i).split(" ")) { ^ Solution.java:21: error: class, interface, or enum expected } ^ Solution.java:23: error: class, interface, or enum expected } ^ Solution.java:25: error: class, interface, or enum expected var max = 0; ^ Solution.java:26: error: class, interface, or enum expected var min = 0; ^ Solution.java:27: error: class, interface, or enum expected for(int i=0; i<players/2; i++) { ^ Solution.java:27: error: class, interface, or enum expected for(int i=0; i<players/2; i++) { ^ Solution.java:27: error: class, interface, or enum expected for(int i=0; i<players/2; i++) { ^ Solution.java:29: error: class, interface, or enum expected min += sums.get(i); ^ Solution.java:30: error: class, interface, or enum expected } ^ Solution.java:32: error: class, interface, or enum expected } ^ 24 errors