This commit is contained in:
Brandon Dyck 2024-12-03 18:02:48 -07:00
parent 01b1781daf
commit 00643faf49
3 changed files with 8 additions and 4 deletions

View File

@ -14,11 +14,15 @@ int main()
bs.insert(b);
}
int total{};
int distance{};
int similarity{};
for (auto ia = as.cbegin(), ib = bs.cbegin(); ia != as.end(); ++ia, ++ib)
{
total += std::abs(*ia - *ib);
distance += std::abs(*ia - *ib);
similarity += *ia * bs.count(*ia);
}
std::cout << total << "\n";
std::cout << "Total difference: " << distance << "\n";
std::cout << "Total distance: " << similarity << "\n";
return 0;
}

View File

View File

@ -3,7 +3,7 @@ RM=rm -rf
CXXFLAGS=-g -Wall -Wextra -pedantic -std=c++20
BUILD=build
MKDIR=mkdir
EXES=1a
EXES=1
$(EXES): %: %.cpp
$(CXX) $(CXXFLAGS) $^ -o $@