-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
55 lines (44 loc) · 1.09 KB
/
main.cpp
File metadata and controls
55 lines (44 loc) · 1.09 KB
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
#include "filter.h"
int main()
{
try
{
ip_pool_list ip_pool;
for (std::string line; std::getline(std::cin, line);)
{
if (line.length() == 0)
break;
auto t = split(split(line, '\t').at(0), '.');
ip_vec c;
for (auto& i : t)
c.push_back(std::stoi(i));
ip_pool.push_back(c);
}
//revers lexicographically sort
ip_pool.sort(std::greater<ip_vec>());
printIpPool(ip_pool);
// ip = filter(1)
for (auto ip : ip_pool)
{
if (filter(*(ip.cbegin()), 1))
printVector(ip);
}
// ip = filter(46, 70)
for (auto ip : ip_pool)
{
if (filter(*(ip.cbegin()), 46, 70))
printVector(ip);
}
// ip = filterAny(46)
for (auto ip : ip_pool)
{
if (filterAny(ip, 46))
printVector(ip);
}
}
catch (const std::exception &e)
{
std::cerr << e.what() << std::endl;
}
return 0;
}