TOPIC

I cannot deal with it

JVMDO asked 3 years ago

Why 100% WA ???

#include <iostream>
#include <iomanip>

using namespace std;

double continuedFraction( int, double );

int main()
{
    double s;
    int n;
    cin >> n;

    cout << fixed << setprecision( 10 );
    cout << continuedFraction( n, s ) << endl;

    return 0;
}

double continuedFraction( int n, double s )
{
    if( n == 0 )
        return s+3;

    s += 6.0; s = 1.0/s;
    return continuedFraction( --n, s );
}

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.