View Code of Problem 3697

#include<iostream>
#include<string>
using namespace std;
int main()
{
	long long k,n,s,i,j;
	 cin>>n ;
	
		while( n-- )
		{
			cin>>k>>s;
			if( k < s )
			{
				for( i=k;i<=s;i++ )
				{
					cout<<i<<" frogs have "<<i<<" mouths, "<<i*2<<" eyes and "<<i*4<<" legs, jump into the water with ";
					//输出splash
					for(j=0;j<i;j++ )
					{
						cout<<"splash";
						if( j+1 < i)
						cout<<" ";
						else cout<<"."<<endl;
					}
				}
			} else
			{		//k=10,s=3;
				for( i=k;i>=s;i-- )
				{
					cout<<i<<" frogs have "<<i<<" mouths, "<<i*2<<" eyes and "<<i*4<<" legs, jump into the water with ";
					//输出splash
					for(j=0;j<i;j++ )
					{
						cout<<"splash";
						if( j+1 < i)
						cout<<" ";
						else cout<<"."<<endl;
					}
				}				
			}
			
		}
	
	return 0;
}

Double click to view unformatted code.


Back to problem 3697