import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); int N=scanner.nextInt(); for(int i=0;i<N;i++) { int K=scanner.nextInt(); int S=scanner.nextInt(); if (S>K) { for (int j = K; j <= S;j++) { System.out.printf("%d frog has %d mouth, %d eyes and %d legs, jumps into the water with",j,j,j*2,j*4); for (int j2 = 0; j2 < j; j2++) { System.out.print(" splash"); } System.out.println("."); } }else { for (int j = K; j>=S ;j--) { System.out.printf("%d frog has %d mouth, %d eyes and %d legs, jumps into the water with",j,j,j*2,j*4); for (int j2 = 0; j2 < j; j2++) { System.out.print(" splash"); } System.out.println("."); } } } } } |
Double click to view unformatted code.