QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#24259 | #2291. Lopsided Lineup | jskop | RE | 0ms | 0kb | Java8 | 883b | 2022-03-28 20:47:10 | 2022-04-30 05:21:57 |
Judging History
answer
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Solution
{
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String line = "";
ArrayList<String> lines = new ArrayList<String>();
ArrayList<Integer> sums = new ArrayList<Integer>();
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);
int max = 0;
int 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);
}
}
详细
Test #1:
score: 0
Runtime Error
input:
20 0 786505 911962 -800624 363821 -960995 -492637 -246590 140762 54707 -353306 -82216 -175650 567363 113374 761152 906126 -394096 -635055 675627 786505 0 801116 -323471 -34197 -860051 865281 737621 307515 -493253 -128788 -171663 -21931 853897 -505337 72985 941995 -380960 -223577 265322 911962 801116...