✕
Maps and Sets (C++)Coding problems
Maps and Sets (C++): coding problems
Write a program that reads the input and prints the answer. Run checks it against every test, including hidden ones.
0 of 8 solved
A conference hands out badge numbers to visitors. The printer sometimes printed the same number twice, so the list can repeat values. Count how many different badge numbers were handed out.
Use a set. Insert each number and ask the set for its size at the end. A set stores each value once, so a repeat costs nothing and changes nothing.
Constraints:
1 <= n <= 800, and each badge number is between-1000000000and1000000000.Input. Line 1: `n`, the count of numbers. Line 2: the `n` badge numbers, separated by spaces.
Output. One integer: how many different numbers there are.
Example 1 input
5 3 9 3 1 9
Output
3
Example 2 input
1 -7
Output
1