-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodulo.cpp
59 lines (49 loc) · 942 Bytes
/
modulo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* @file modulo.cpp
* @author your name ([email protected])
* @brief Modulo Problem from Kattis
* @version 0.1
* @date 2023-06-17
*
* @copyright Copyright (c) 2023
*
* Source: https://open.kattis.com/problems/modulo
*/
#include <cstdlib>
#include <iostream>
#include <set>
struct Solver
{
auto solve() -> int;
std::set<int> modulos = {};
};
auto operator>>( std::istream& in, Solver& solver ) -> std::istream&;
auto
main() -> int
{
auto solver = Solver();
while ( std::cin >> solver )
{
std::cout << solver.solve() << '\n';
}
return EXIT_SUCCESS;
}
auto
operator>>( std::istream& in, Solver& solver ) -> std::istream&
{
solver.modulos.clear();
int number;
for ( auto i = 0; i < 10; ++i )
{
in >> number;
if ( !in )
return in;
solver.modulos.insert( number % 42 );
}
return in;
}
auto
Solver::solve() -> int
{
return modulos.size();
}