ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1563. Bayan

Accepted in Java 1.7
Posted by Axmadjon 1 May 2014 12:20
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class AcmTimusRu {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String[] strings = new String[1000];
        Set<String> set = new HashSet<String>();
        int n, i;

        n = s.nextInt();
        n =n +1;
        for (i = 0; i < n; i++) {
            set.add(s.nextLine());
        }
        if (n == set.size()) {
            System.out.println(0);
        } else {
            int n1 = set.size();
            n1 = n - n1;
            System.out.println(n1);
        }
    }
}

Edited by author 01.05.2014 12:20

Edited by author 01.05.2014 12:20