Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int locations;
- cin >> locations;
- for (int i = 0; i < locations; i++) {
- double averageGold, gold, goldSum = 0;
- cin >> averageGold;
- int dayDigging;
- cin >> dayDigging;
- for (int j = 0; j < dayDigging; j++) {
- cin >> gold;
- goldSum += gold;
- }
- cout.setf(ios::fixed);
- cout.precision(2);
- if (goldSum / dayDigging >= averageGold) {
- cout << "Good job! Average gold per day: " << goldSum / dayDigging << ".\n";
- }
- else {
- cout << "You need " << averageGold - (goldSum / dayDigging) << " gold.\n";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement