#include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> int main(){ int n; int k,s; scanf("%d",&n); long eye,leg; for(int i=0;i<n;i++){ scanf("%d %d",&k,&s); if(k<=s){ for(int j=k;j<=s;j++){ eye=2*j; leg=4*j; if(j==1){ printf("%d frogs have %d mouths, %ld eyes and %ld legs, jump into the water with a splash.\n",j,j,eye,leg); }else{ printf("%d frogs have %d mouths, %ld eyes and %ld legs, jump into the water with",j,j,2*j,4*j); for(int start=0;start<j-1;start++){ printf(" splash"); } printf(" splash.\n"); } } }else{ //printf("11\n"); for(int j=k;j>=s;j--){ eye=2*j; leg=4*j; if(j==1){ printf("%d frogs have %d mouths, %ld eyes and %ld legs, jump into the water with a splash.\n",j,j,eye,leg); }else{ printf("%d frogs have %d mouths, %ld eyes and %ld legs, jump into the water with",j,j,eye,4*j); for(int start=0;start<j-1;start++){ printf(" splash"); } printf(" splash.\n"); } } } } } |
Double click to view unformatted code.