1 solutions

  • 0
    @ 2023-1-17 14:33:01
    #include <bits/stdc++.h> 
    using namespace std;
    int main()
    {
        int n,sum=0;
        cin >> n;
        for(int i = 1; i < n; i++)//比赛次数实际上就是公差为一等差数列,用for循环就可以算出
        {
            sum += i;
        }
        cout << sum << endl;
        return 0;
    }
    
    
    • 1

    Information

    ID
    669
    Time
    1000ms
    Memory
    16MiB
    Difficulty
    10
    Tags
    # Submissions
    3
    Accepted
    3
    Uploaded By