[Guidance] What's the method to get precision till decimal place defined by user ?

I am working on this problem LMA1

I tried this method from the editorial. Why am I getting WA ?

using namespace std;

int main(){
double t,a,n,p,d,q;

return 0;

You can’t solve it in this way; precision of standard C++ data types is far from 10000 digits :slight_smile:

Check editorial (and codes provided there) once again to get the idea how to calcualte digits of common fraction one by one.

Can you tell me why my code is not accepted please ? :slight_smile:

Kinda obvious answer - because it gives wrong answer.

I already said it in my message above.

1 Like

try writing cout<<fixed<<setprecision(d)<<… instead of only cout<<setprecesion(d)<<…

try writing cout<<fixed<<setprecision(d)<<…instead of cout<<setprecision(d)<<…