QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#24256#2291. Lopsided LineupjskopCompile Error//Java8856b2022-03-28 20:45:212022-05-18 04:15:51

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:51]
  • 评测
  • [2022-03-28 20:45:21]
  • 提交

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) {
		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);
	}
}

詳細信息

Solution.java:13: error: unexpected type
		ArrayList<int> sums = new ArrayList<int>();
		          ^
  required: reference
  found:    int
Solution.java:13: error: unexpected type
		ArrayList<int> sums = new ArrayList<int>();
		                                    ^
  required: reference
  found:    int
Solution.java:26: error: cannot find symbol
		var max = 0;
		^
  symbol:   class var
  location: class Solution
Solution.java:27: error: cannot find symbol
		var min = 0;
		^
  symbol:   class var
  location: class Solution
4 errors