1104 Sum of Number Segments(二刷)

时间:2020-03-27 12:31:36   收藏:0   阅读:62

英文题目:1104 Sum of Number Segments

中文题目:1049 数列的片段和

 1 #include<iostream>
 2 using namespace std;
 3 
 4 int main() {
 5     int n;
 6     double t,sum = 0;
 7     cin>>n;
 8     for(int i = 0 ; i < n; ++i) {
 9         cin>>t;
10         sum += (i+1)*t*(n-i);
11     }
12     printf("%.2f\n",sum);
13     return 0;
14 }

技术分享图片

 

原文:https://www.cnblogs.com/keep23456/p/12580495.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!