Problem Link
Can anyone help me out with the difference between this AC solution and mine TLE solution ?
Problem Link
Can anyone help me out with the difference between this AC solution and mine TLE solution ?
endl is very slow. Use \n
These are common mistakes people do.
How will that make any difference ?
What does it do ?(20 char)
I did the exact same solution but got TLE and also I did the declared of n inside loop. Here is my solution.
I will explain u…don’t worry…
But why…is it gives tle just declared inside loop…
Edited. \hspace{0mm}
endl is very slow. Use \n
endl \hspace{0mm}
given n find product of all factorial till N
n =3
1! * 2!*3! = 1^(3) * (2^2) * 3^(1)
here u go : Product of first N factorials - GeeksforGeeks
Here is my solution : CodeChef: Practical coding for everyone (read from line 286)
But I had used ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
so why endl gives TLE?
Please someone list these type of ideas like “endl gives tle” to prevent from errors in future?
Becz you are calculating factorial for each number in each test case, instead of calculating it again & again store the factorial in an array and use it later.
Here’s my code CodeChef: Practical coding for everyone
Try with endl i think u will get tle
when will these problems be avalilable for practice?