雾山五行


私信TA

用户名:uq_26515002996

访问量:742

签 名:

等  级
排  名 11001
经  验 1055
参赛次数 0
文章发表 14
年  龄 0
在职情况 在职
学  校
专  业

  自我简介:

解题思路:

                    

注意事项:

参考代码:



                            

                        #include <stdio.h>

                        /*

                         一球从M米高度自由下落,每次落地后返回原高度的一半,再落下。

                         它在第N次落地时反弹多高?共经过多少米? 保留两位小数

                        */

                        int m1019(){

                                 double m,n;

                                 double sum=0;

                                 scanf("%lf %lf",&m,&n);

                                

                                

                                 for(int i=1;i<=n;i++)

                                 {

                                             if(i==1)

                                             {

                                                     sum+=m;

                                             }

                                             else

                                             {

                                                     m=m/2;

                                                     sum+=2*m;

                                             }

                                            

                                 }

                                 m=m/2;//n次后反弹那次高度 

                                 printf("%.2f %.2f",m,sum);

                                 return 0;

                        }

                        

 

0.0分

0 人评分

  评论区

  • «
  • »