平方和与倒数和 题解:
#include<bits/stdc++.h>
using namespace std;
int main (){
double a, b, c;
cin >> a >> b >> c;
double sum;
sum += (a + 1) /2 * a;
for(int i = 1; i <= b; i++)
sum += i*i;
for(double i = 1; i <= c; i++)
sum += 1.0/i;
printf("%.2f\n", sum);
return 0;
}
登录后发布评论
暂无评论,来抢沙发