(SPOJ) 8707 - Chamada - Solução
import java.io.*;
import java.util.*;
class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
Main processando = new Main();
processando.processa();
System.exit(0);
}
void processa() throws NumberFormatException, IOException {
String line = "";
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
line = br.readLine();
StringTokenizer tokenizer = new StringTokenizer(line);
int numAlunos = Integer.valueOf(tokenizer.nextToken());
int alunoSorteado = Integer.valueOf(tokenizer.nextToken());
String[] alunos = new String[numAlunos];
for (int i = 0; i < numAlunos; i++) {
alunos[i] = br.readLine();
}
Arrays.sort(alunos);
System.out.println(alunos[alunoSorteado-1]);
return;
}
}
import java.util.*;
class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
Main processando = new Main();
processando.processa();
System.exit(0);
}
void processa() throws NumberFormatException, IOException {
String line = "";
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
line = br.readLine();
StringTokenizer tokenizer = new StringTokenizer(line);
int numAlunos = Integer.valueOf(tokenizer.nextToken());
int alunoSorteado = Integer.valueOf(tokenizer.nextToken());
String[] alunos = new String[numAlunos];
for (int i = 0; i < numAlunos; i++) {
alunos[i] = br.readLine();
}
Arrays.sort(alunos);
System.out.println(alunos[alunoSorteado-1]);
return;
}
}
Comments
Post a Comment