Last active
May 19, 2018 07:45
-
-
Save deviantfero/c340e96ba9a886324a1b868cca2208c0 to your computer and use it in GitHub Desktop.
solution to problem 10300 in C++
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <iostream> | |
#include <vector> | |
int main() { | |
int area, friendliness, animals; | |
int tests, farmers, aux = 0; | |
std::vector<int> debt; | |
std::cin >> tests; | |
for(; tests > 0; tests--, aux = 0) { | |
std::cin >> farmers; | |
for(; farmers > 0; farmers--) { | |
std::cin >> area >> animals >> friendliness; | |
aux += area * friendliness; | |
} | |
debt.push_back(aux); | |
} | |
std::for_each(debt.begin(), debt.end(), [](auto d) { std::cout << d << "\n"; }); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment