题解 | #数列的和#

数列的和

https://www.nowcoder.com/practice/fe19f8a78a5148018f4be53ae9b5e11e

#include <stdio.h>
#include<math.h>
int main() {
    int m = 0;
    int n = 0;
    while (~scanf("%d %d", &n, &m)) {
        double num = (double)n;
        double sum = (double)n;
        for (int i = 1; i < m; i++) {
            sum += sqrt((double)num);
            num = sqrt(num);
        }
        printf("%.2lf\n", sum);
    }
    return 0;
}

全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务