View Code of Problem 3697

#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int main(void)
{
    int n;
    scanf("%d", &n);
    while (n--)
    {
        long long a, b;
        scanf("%lld %lld", &a, &b);
        if (a < b)
        {
            while (a <= b)
            {
                if(a == 1)
                printf("1 frog has 1 mouth, 2 eyes and 4 legs, jumps into the water with a");
                else
                printf("%lld frogs have %lld mouths, %lld eyes and %lld legs, jump into the water with", a, a, a * 2, a * 4);
                for (int i = 0; i < a; i++)
                    printf(" splash");
                printf(".\n");
                a++;
            }
        }
        else
        {
            while (a >= b)
            {
                if(a == 1)
                printf("1 frog has 1 mouth, 2 eyes and 4 legs, jumps into the water with a");
                else
                printf("%lld frogs have %lld mouths, %lld eyes and %lld legs, jump into the water with", a, a, a * 2, a * 4);
                for (int i = 0; i < a; i++)
                    printf(" splash");
                printf(".\n");
                a--;
            }
        }
    }
}

Double click to view unformatted code.


Back to problem 3697