View Code of Problem 3697

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<climits>
#include<cmath>
#include<map>
#include<set>
#include<queue>

using namespace std;


int main()
{
	int n;

	while (cin >> n) {

		for (int i = 0; i < n; i++) {

			int k, s;
			cin >> k >> s;

			if (k > s)
				swap(k, s);

			for (int j = k; j <= s; j++) {

				if (j == 1) {

					cout << "1 frog has 1 mouth, 2 eyes and 4 legs, jumps into the water with a splash." << endl;
					continue;
				}

				cout << j << " frogs have " << j << " mouths, " << j * 2 << " eyes and " << j * 4 << " legs, jump into the water with ";

				for (int z = 0; z < j; z++) {

					cout << "splash";

					if (z != j - 1)
						cout << " ";
					else
						cout << ".";
				}

				cout << endl;
			}
		}
	}
}

Double click to view unformatted code.


Back to problem 3697