You are viewing a single comment's thread. Return to all comments →
Simple C++ Solution
#include <bits/stdc++.h> using namespace std; int main() { long long t, n; cin >> t; for (int q = 0; q < t; ++q) { cin >> n; cout << n * (n + 1) * (3 * n * n - n - 2) / 12 << "\n"; } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #6: Sum square difference
You are viewing a single comment's thread. Return to all comments →
Simple C++ Solution