Thursday, 23 January 2014

UVa Problem ID 10258 (Contestant scoreboard)

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;

public class Main {
	public static void main(String[] args) throws IOException 
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuffer sb=new StringBuffer("");
        String input;
        int testcases=Integer.parseInt(br.readLine());
        br.readLine();
        for (int i = 0; i 0)
        		sb.append("\n");
			
			int no_of_contestants=0;
			Contestant contestants[]=new Contestant[100];
			 while ((input = br.readLine()) != null) {
	                if (input.trim().equals("")) {
	                    break;
	                }
				String s[]=input.split(" ");
				//System.out.println("**********"+input+"*********");
				if(Integer.parseInt(s[0]) < 0 || Integer.parseInt(s[0])>100 ||Integer.parseInt(s[1])<1 ||Integer.parseInt(s[1])>9)
						break;
				boolean found=false;
				Contestant c=null;
				for (int j = 0; j 
{
	int number;
	int problemsolved;
	int totaltime;
	HashMap unsolved=new HashMap();
	HashMap solved=new HashMap();
	public Contestant(int no)
	{
		number=no;
	}
		
	@Override
	public int compareTo(Contestant B) {
		if(this.problemsolved>B.problemsolved)
			return -1;
		else if(this.problemsolvedB.totaltime)
				return +1;
			else
			{
				if(this.number
Previous Post
Next Post

0 comments:

Advertisement