Why FCTRL2 showing wrong answer? Whats the problem here can anybody explain?

#include
using namespace std;
int main()
{
int x, y[100], result=1;
cin>>x;
for(int i=0; i<x; i++){
cin>>y[i];
}
for(int i=0; i<x; i++){
for(int j =y[i]; j>1; j–) {
result = result*j;

    }
    cout<<result<<result;
    result = 1;
}

return 0;

}

Please always include a link to your solution submission, for example: https://www.codechef.com/viewsolution/19891785

If you want to paste code directly into your question, you should then select it and use the 101/010 button to indent it so that it is displayed properly. But it’s better to just have a link and explain how your code works.


You might like to try out a testcase of n=21, to see how your program responds to a big result. Ideally you should have tried out n=100, the limit value, before submitting.

The expected result for 21 is 51090942171709440000. Factorial 100 has 158 digits.


You used to have some code that was relatively close to a solution for very small integers, but I suspect you have been making random changes. That might explain why you appear to have a double output of result.