3 solutions

  • 1
    @ 2026-2-23 12:10:36
    #include <iostream>
    using namespace std;
    int main() {
        int n;
        cin >> n; 
        int total = n * (n + 1) * (2 * n + 1) / 6;
        cout << total << endl;  
        return 0;
    }
    
    

    Information

    ID
    24
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    5
    Tags
    # Submissions
    21
    Accepted
    13
    Uploaded By