Skip to content

Instantly share code, notes, and snippets.

@bluescarni
Created June 19, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bluescarni/958471b1ab351921799b to your computer and use it in GitHub Desktop.
Save bluescarni/958471b1ab351921799b to your computer and use it in GitHub Desktop.
my_pair temp;
for (auto &a: A) {
for (auto &b: B) {
temp.first = a.first + b.first;
auto it = C.find(temp);
if (it == C.end()) {
temp.second = a.second * b.second;
C.insert(temp);
} else {
it->second += a.second * b.second;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment