1 solutions

  • 0
    @ 2026-11-5 20:16:21
    #include<bits/stdc++.h>
    using namespace std;
    int f(int n){
        if(n==1)return 1;
        return f(n-1)+n;
    }
    int main(){
        int n;
        cin>>n;
        cout<<f(n)<<endl;
        return 0;
    }
    
    
    • 1

    Information

    ID
    305
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    (None)
    # Submissions
    31
    Accepted
    17
    Uploaded By