PAT 乙级 1049 数列的片段和 (20分)
作者:互联网
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
double sum = 0.0, temp;
for (int i = 1; i <= n; i++)
{
cin >> temp;
sum = sum + temp * i * (n - i + 1);
}
printf("%.2f", sum);
system("pause");
return 0;
}
标签:%.,PAT,temp,int,1049,cin,20,sum 来源: https://blog.csdn.net/qq_43180487/article/details/110243975