Last active
August 29, 2015 13:56
-
-
Save Vannevelj/8823981 to your computer and use it in GitHub Desktop.
Vlaamse Programmeer Wedstrijd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Scanner; | |
public class Test { | |
private static Scanner sc = new Scanner(System.in); | |
private static List<MiniMax> lijsten = new ArrayList<MiniMax>(); | |
public static void main(String[] args) { | |
int aantalLijsten = sc.nextInt(); | |
for(int i = 0; i < aantalLijsten; i++){ | |
int aantalGetallen = sc.nextInt(); | |
MiniMax resultaat = new MiniMax(); | |
resultaat.volgGetal = i + 1; | |
for(int k = 0; k < aantalGetallen; k++){ | |
int getal = sc.nextInt(); | |
resultaat.Bereken(getal); | |
} | |
lijsten.add(resultaat); | |
} | |
for(MiniMax lijst : lijsten){ | |
System.out.println(lijst); | |
} | |
} | |
} | |
class MiniMax { | |
public int volgGetal; | |
public int min = Integer.MAX_VALUE; | |
public int max = Integer.MIN_VALUE; | |
public void Bereken(int g){ | |
if(g > max) { max = g; } | |
if(g < min) { min = g; } | |
} | |
@Override | |
public String toString() { | |
return volgGetal + " " + min + " " + max; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment