Advertisement
zsoltizbekk

IQ huszár

Oct 26th, 2015
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         String line, max_nev="";
  7.         int max = 0;
  8.         Scanner sc = new Scanner(System.in);  
  9.         while (sc.hasNext()){
  10.             line = sc.nextLine();
  11.             String[] tok = line.split(" ");
  12.             int iq = Integer.parseInt(tok[0]);
  13.             if (iq == 0 && line.length() == 1){
  14.                 break;
  15.             }
  16.             String nev = tok[1];      
  17.             if (iq > max){
  18.                 max = iq;
  19.                 max_nev = nev;
  20.             }      
  21.         }
  22.             if (max > 0)
  23.             System.out.println(max_nev + " [" + max + "]");  
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement