AOJ Problem NO.492青蛙过河

NO.492青蛙过河

一群青蛙在河边,他们想过河。可是他们喜欢表演啊,想边唱歌边过河。
这首歌大家都会唱啊:
1 frog has 1 mouth , 2 eyes and 4 legs , plop dives into the water .
2 frogs have 2 mouths , 4 eyes and 8 legs , plop plop dive into the water .
3 frogs have 3 mouths , 6 eyes and 12 legs , plop plop plop dive into the water .
……
究竟应该怎么唱呢?我们就来研究一下。
现在我们看到了n只青蛙,我们来猜猜他们唱歌的歌词是什么

INPUT

行1:一个正整数n(1≤n≤100),代表青蛙的个数
OUTPUT
行1:青蛙过河的歌词。格式为:
W frog(s) have(has) X mouth(s) , Y eye(s) and Z leg(s) , (plop…plop) dive(s) into the water .
注意括号不是输出内容。W、X、Y、Z分别代表青蛙个数,嘴巴个数,眼睛个数,腿个数。然后有N个plop(扑通声)。任何单词(包括数字和符号)之间都是由一个空格分开的,别在这里绊住了)。注意个数为1的时候要用单数形式



#include <stdio.h>
#include <string.h>
int main()
{
  int n,i;
  char a[525]={"plop "},b[25]={"dive into the water ."},c[]={"plop "};  
  scanf("%d",&n);
  if (n==1) printf("1 frog has 1 mouth , 2 eyes and 4 legs , plop dives into the water .\n");
  else  
  { 
for(i=0;i<n-1;i++)
     strcat(a,c);
  strcat(a,b);
  printf("%d frogs have %d mouths , %d eyes and %d legs , ",n,n,2*n,4*n);
  printf("%s\n",a);}
  return(0);
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值