#include <stdio.h> #include <stdlib.h> int main() { int i,N,K,S,j,m; scanf("%d",&N); for(i=0;i<N;i++) { scanf("%d%d",&K,&S); if(K>S) { for(j=K;j>=S;j--) { if(j==1) { printf("1 frog has 1 mouth, 2 eyes and 4 legs, jumps into the water with a splash.\n"); } else { printf("%d frogs have %d mouths, %d eyes and %d legs, jump into the water with ",j,j,2*j,4*j); for(m=0;m<j;m++) { if(m==j-1) { printf("splash.\n"); } else { printf("splash "); } } } } } else { for(j=K;j<=S;j++) { if(j==1) { printf("1 frog has 1 mouth, 2 eyes and 4 legs, jumps into the water with a splash.\n"); } else { printf("%d frogs have %d mouths, %d eyes and %d legs, jump into the water with ",j,j,2*j,4*j); for(m=0;m<j;m++) { if(m==j-1) { printf("splash.\n"); } else { printf("splash "); } } } } } } return 0; } |
Double click to view unformatted code.