1104 Sum of Number Segments(二刷)
英文题目: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 }