Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int days, winTotal = 0, loseTotal = 0;
- cin >> days;
- string command;
- double totalSum = 0;
- for (int i = 0; i < days; i++) {
- int win = 0, lose = 0;
- double sum = 0;
- while (true) {
- cin >> command;
- if (command == "win") {
- sum += 20;
- win++;
- }
- else if (command == "lose") {
- lose++;
- }
- else if (command == "Finish") {
- if (win > lose) {
- totalSum += sum * 1.1;
- winTotal += win;
- }
- else {
- totalSum += sum;
- loseTotal += lose;
- }
- break;
- }
- }
- }
- cout.setf(ios::fixed);
- cout.precision(2);
- if (winTotal > loseTotal) {
- cout << "You won the tournament! Total raised money: " << totalSum * 1.2 << endl;
- }
- else {
- cout << "You lost the tournament! Total raised money: " << totalSum << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement