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的时候要用单数形式
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);
}
#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);
}