1184C language Experiment--shoot the ball

Source: Internet
Author: User
The topic describes small Yu 3 years old, likes playing the ball very much, seems to like playing the basketball ^_^ in the future. She recently found that when the ball fell from her hand, she jumped back to half of the original height each time she landed, fall again, each time the ball hit several times when the ball, the number of n times when the father on the side of the shouting stop, asked little yoga now the ball in the end how many distance, small yoga pretending to meditate, dad asked the next small ball can jump how high ah, little yoga shook his head, How can I know if my father is God? At this time you are on the side of the advice to small yoga to write a program calculation, so the task to you. Assuming the initial height of the ball is H, calculate the distance of the ball after the nth landing, and how high the bounce can be after landing. input Data has multiple groups, the first behavior Data group T, the following T behavior T-group data, each row has two numbers h and N, separated by a space. output of the first n rebound when the ball passes the distance and the final height of the ball, retain 2 digits after the decimal point. Sample Input
2
1
100.0 2
Sample output
100.00 50.00
200.00 25.00
#include <stdio.h>
void Main ()
{
int a,i;
Double s,t,m,n;
scanf ("%d", &a);
while (a--)
{
s=0;
scanf ("%lf%lf", &m,&n);
T=m;
for (i=1;i<=n;i++)
{
s=s+m*2;
M=M/2;
}
S=s-t;
printf ("%.2lf%.2lf\n", s,m);

}
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.