[Plain] Description
The sequence is defined as follows:
The first item of the series is n, and the subsequent items are the square root of the previous item, and the sum of the first m items of the series is obtained.
Input
There are multiple groups of input data. Each group occupies one row and consists of two integers n (n <10000) and m (m <1000). The meanings of n and m are as described above.
Output
For each group of input data, the sum of the output columns, each test instance occupies a row, requires that the precision be kept with 2 decimal places.
Sample Input
81 4
2 2
Sample Output
94.73
3.41
Description
The sequence is defined as follows:
The first item of the series is n, and the subsequent items are the square root of the previous item, and the sum of the first m items of the series is obtained.
Input
There are multiple groups of input data. Each group occupies one row and consists of two integers n (n <10000) and m (m <1000). The meanings of n and m are as described above.
Output
For each group of input data, the sum of the output columns, each test instance occupies a row, requires that the precision be kept with 2 decimal places.
Sample Input
81 4
2 2
Sample Output
94.73
3.41
[Plain] # include <stdio. h>
# Include <math. h>
Int main ()
{
Int I;
Int n;
Int m;
Float t;
Float sum;
While (scanf ("% d", & n, & m )! = EOF)
{
Sum = t = n * 1.0;
For (I = 1; I <m; I ++)
{
Sum + = sqrt (t );
T = sqrt (t );
}
Printf ("% 0.2f \ n", sum );
}
Return 0;