import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scanner=new Scanner(System.in); int n=scanner.nextInt(); while(n-->0) { int k=scanner.nextInt(); int s=scanner.nextInt(); if(k>s) { for(int i=k;i>=s;i--) { if(i==1) { System.out.print(i+" frog has "+i+" mouth, "+i*2+" " + "eyes and "+i*4+" legs, jumps into the water with"); for(int j=1;j<=i;j++) { System.out.print(" splash"); } System.out.println("."); } else { System.out.print(i+" frogs have "+i+" mouths, "+i*2+" " + "eyes and "+i*4+" legs, jump into the water with"); for(int j=1;j<=i;j++) { System.out.print(" splash"); } System.out.println("."); } } } else { for(int i=k;i<=s;i++) { if(i==1) { System.out.print(i+" frog has "+i+" mouth, "+i*2+" " + "eyes and "+i*4+" legs, jumps into the water with"); for(int j=1;j<=i;j++) { System.out.print(" splash"); } System.out.println("."); } else { System.out.print(i+" frogs have "+i+" mouths, "+i*2+" " + "eyes and "+i*4+" legs, jump into the water with"); for(int j=1;j<=i;j++) { System.out.print(" splash"); } System.out.println("."); } } } } } } |
Double click to view unformatted code.