#include<stdio.h> #include<string.h> #include<math.h> #include<stdlib.h> /*本道题的坑很大,特别要注意当数到一只青蛙时,最后splash之前加a。其他数量的青蛙和sample out样式一样*/ int main() { int n,i,j; scanf("%d",&n); while(n--) { int k,s,sum; scanf("%d%d",&k,&s); if(k<=s) { for(j=k;j<=s;j++) { if(j==1) { printf("%d frog has %d mouth, %d eyes and %d legs, jumps into the water with a splash.\n",j,j,j*2,j*4); } else { printf("%d frogs have %d mouths, %d eyes and %d legs, jump into the water with",j,j,j*2,j*4); for(i=0;i<j;i++) { printf(" splash"); } printf(".\n"); } } } else { for(j=k;j>=s;j--) { if(j==1) { printf("%d frog has %d mouth, %d eyes and %d legs, jumps into the water with a splash.\n",j,j,j*2,j*4); } else { printf("%d frogs have %d mouths, %d eyes and %d legs, jump into the water with",j,j,j*2,j*4); for(i=0;i<j;i++) { printf(" splash"); } printf(".\n"); } } } } return 0; } |
Double click to view unformatted code.