WHAT HAPPENS IS THAT THE EXE FILE GENERATED FOR SOLVING THE PROBLEMS DOESNT PRODUCE ANY RESULT AT ALL ITS JUST THE BLANK BLACK SCREEN. DUE TO LARGE INPUTS WHICH I THINK SHOULD BE FAIRLY COMPUTABLE
Can u suggest some method to optimize code
for example #include<iostream>
using namespace std;
int main ()
{for(long g=50;g<1E7;++g)
{int d=2;
long p=((g*(g+1))/2);
for(long c=2;c<p;++c)
if(!(p%c))
++d;
if (d>=499)
{cout<<g<<endl<<d;int a;cin>>a;
}
}return 0;
}
#include<iostream>
usingnamespace std;
int main ()
{
for(long g=50; g < 10000000; ++g)
{
int d=2;
long p= (g*(g+1))/2;
for(long c=2; c<p; ++c)
{
if(!(p%c))
++d;
}
if (d >= 499)
{
cout<<g<<endl<<d;
int a;
cin>>a;
}
}
return 0;
}
Also, the best 'd' result is 320, gotten from 'g' being 2079.
Probably the reason why you don't get in the 'd >= 499' part.
Still looking for best numbers.