Advertisement
Guest User

Untitled

a guest
May 27th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Ege14 {
  4.     public static void main(String [] args){
  5.         Scanner s = new Scanner(System.in);
  6.         int N = s.nextInt();
  7.         int a[] = new int[99];
  8.         for(int i = 0 ; i < 99 ; i++) {
  9.             a[i] = 0;
  10.         }
  11.         for(int i = 0 ; i < N ; i++){
  12.             s.next();
  13.             s.next();
  14.             int p = s.nextInt();
  15.             a[p-1]++;
  16.         }
  17.         int max = 0;
  18.         for(int i = 0 ; i < 99 ; i++ ){
  19.          if(a[i] > max){
  20.              max = a[i];
  21.          }
  22.         }
  23.         for (int i = 0 ; i < 99 ; i++){
  24.             if (a[i] == max){
  25.                 System.out.print(i+1 + " " );
  26.             }
  27.         }
  28.  
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement