提交时间:2024-08-20 15:22:58
运行 ID: 169160
#include <iostream> using namespace std; int a[1010]; int main() { int n; cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i]; } unsigned long long sum = 0; for (int i = 0; i < n; ++i) { for (int j = i + 1; j < n; ++j) { for (int k = j + 1; k < n; ++k) sum += a[i] + a[j] + a[k]; } } cout << sum; }