1 solutions

  • 0
    @ 2025-12-9 16:04:04

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    long long n,m,s;
    int main(){
    //	freopen("10.in","r",stdin);
    //	freopen("10.out","w",stdout);
        cin>>m>>n;
        s=(1+n)*n/2;
        if(m>=s) cout<<0;
        else cout<<s-m;
        return 0;
    }
    
    
    • 1

    Information

    ID
    1018
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    4
    Tags
    (None)
    # Submissions
    43
    Accepted
    21
    Uploaded By