1 solutions

  • 0
    @ 2024-12-10 23:49:12

    C++ :

    #include <bits/stdc++.h>
    using namespace std ;
    int x, n ;
    double f(int x, int n) {
        if(n == 1) return (double) x / (1 + x) ;
        return (double)x / (n + f(x, n - 1)) ;
    }
    int main() {
        cin >> x >> n ;
        printf("%.2lf", f(x, n)) ;
        return 0 ;
    }
    
    • 1

    Information

    ID
    632
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    10
    Tags
    # Submissions
    2
    Accepted
    1
    Uploaded By