Pagini recente » Monitorul de evaluare | Cod sursa (job #1138892) | Rating Pop-Coman Florin (Florinellu) | Profil vicorico | Cod sursa (job #2703679)
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class HashMapImplementation {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(new FileReader("hashuri.in"));
PrintWriter pw = new PrintWriter("hashuri.out");
Set<Integer> set = new HashSet<>();
int n = sc.nextInt();
while (n-- > 0) {
int op = sc.nextInt();
int nbr = sc.nextInt();
switch (op) {
case 1:
set.add(nbr);
break;
case 2:
set.remove(nbr);
break;
case 3:
pw.println(set.contains(nbr) ? 1 : 0);
}
}
pw.flush();
}
}