This program is working for smaller input
but not working for bigger input like 583291
Also i am facing this error for some quite time,
Plzz help with this error
Error code 255
Back when I learned C++, the compiler didn’t like declaring a dynamic c-style array like array[variable_size]
but it was more than 10 years ago and I am not sure how it has been nowadays… The old-school ll *f = new ll[n+1];
works by the way.
Anyway, it’s a non-ST problem but a C++ one.
Yes it works ,but i used to declare array like this arr[n] and it work in online ide, i dont know why this sublime text is showing this error
Note that your error has nothing to do with Sublime Text. As seen in the output Sublime Text is simply running g++
. The likely culprit is that your “online ide” uses Linux and thus has a much larger stack size by default, whereas on windows it defaults to a much lower stack size. The solution is to not allocate large arrays on the stack at all.
All else being equal, providing your actual source code in some fashion (pasting the text or linking to the file elsewhere) will make it easier for others to help you with it. Screenshots are fairly useless for something like this.
On the one hand, the whole of your code is not present. It also requires anyone that wants to help you to manually transcribe your code if they need to run it to get more insight into what’s going wrong.
/Author -> Sambhu show(JGEC)/
#include<bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define itc ll t;cin>>t;while(t–)
#define PI 3.141592653589793238
#define Max(a,b,c) max(a,max(b,c));
#define Min(a,b,c) min(a,min(b,c));
#define all(v) v.begin(),v.end()
#define ll long long int
#define ld long double
#define pb push_back
#define eb emplace_back
#define gcd(a,b) __gcd(a,b)
#define fi first
#define se second
#define endl “\n”
void solve()
{
ll n;
cin >> n;
ll Mod = 1e9 + 7;
ll fact[n + 1];
fact[0] = 1; fact[1] = 1;
for (ll i = 2; i <= n; i++)
{ fact[i] = fact[i - 1] * i;
fact[i] %= Mod;
}
ll ans = fact[n];
cout << ans << endl;
}
int main()
{
fio
solve();
return 0;
}
here i have pasted the code, i also installed mingw watching your video also, please help
so what happened i have installed sublime text and mingw previously also and at that time it was working fine, it is only this time after i recovered and reset my laptop after my hard disk got crashed. i have done the same process of installing but now sublime is showing errors ,can’t really find where the problem is.
Sublime is showing you errors in the thing you told it to run; that’s not a Sublime problem, that’s a problem with the compiler or with your code.
well it is working for inputs size upto 10^5 but not for 10^6. so not a problem in code, i think its compiler problem