D. Minimum Triangulation
Solution
$\sum_{i=2}^{n-1}i*(i+1)$
Code
#include <iostream>
typedef long long LL;
using namespace std;
int main() {
int n;
LL ans = 0;
cin >> n;
for (int i = 2; i < n; i++)ans += i * (i + 1);
cout << ans << endl;
return 0;
}