You are viewing a single comment's thread. Return to all comments →
Even better c++ code:
#include <vector> #include <iterator> #include <algorithm> #include <numeric> #include <iostream> using namespace std; int main() { vector<int> a(3), b(3); copy_n(istream_iterator<int>(cin), 3, begin(a)); copy_n(istream_iterator<int>(cin), 3, begin(b)); cout << inner_product(begin(a), end(a), begin(b), 0, plus<int>(), greater<int>()) << ' ' << inner_product(begin(b), end(b), begin(a), 0, plus<int>(), greater<int>()) << endl; return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Compare the Triplets
You are viewing a single comment's thread. Return to all comments →
Even better c++ code: