Created
April 25, 2015 18:29
-
-
Save Zulcom/1df9d7bc35f8909614d5 to your computer and use it in GitHub Desktop.
ПРограмма, которая выводит среднее кол-во сотрудников в одном подразделении данного учереждения. Входной формат <Surname> <Initials> <ph.nmbr>, отличия номеров разделов только в последних двух цифрах.
This file contains hidden or 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.*; | |
public class c4_5{ | |
public static void main(String[] args){ | |
Integer N = new Scanner(System.in).nextInt(); | |
TreeSet<Integer> num = new TreeSet<>(); //treeset for exclude duplicates | |
for(int i = 0; i < N; i++) num.add(Integer.parseInt(new Scanner(System.in).nextLine().split(" ")[2].substring(7))); //parse to num only 2 last int | |
System.out.println(num.size()/N); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment