b294. 經濟大恐荒

解法一

✅ 完整代碼

評分結果(參考) : AC (2ms, 328KB)

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n, x, total = 0;
    cin >> n;
    
    for(int i=1; i<=n; i++){
        cin >> x;
        total += i*x;
    }
    cout << total;
    
    return 0;
}