#include<iostream>
#include<math.h>
using namespace std;
int main()
{
long int t,n;
cin>>t;
while(t--)
{
cout<<"abc";
}
return 0;
}
i am getting run time error for t>10000.
how to solve it. range of t>1000000
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
long int t,n;
cin>>t;
while(t--)
{
cout<<"abc";
}
return 0;
}
i am getting run time error for t>10000.
how to solve it. range of t>1000000
What compiler and OS are you using? What's the runtime error?
Are you redirecting output to a file? SIGXFSZ is the signal raised when a file exceeds its size limitation.
actually there is a question on a website in which number of test cases are <1000000
i am submitting there. the site is giving me time limit exceeded.
my code complexity is O(1). so i tried it on ideone which gives me run time error.
i am submitting there. the site is giving me time limit exceeded.
Okay, that's completely different. Obviously if you're writing to cout over 10,000 times then it's going to take a while. That's the problem, and the root cause is that your code is too slow due to the overhead of output.
my code complexity is O(1).
No, your code complexity is O(t).
so i tried it on ideone which gives me run time error.
It's not unreasonable to assume that Ideone has stringent limits on things like this, so I'm not surprised at all that you got a SIGXFSZ error. Use a real compiler on your local machine and that error will vanish.
in my code i have to calculate just sqrt of input.
i tried scanf but it gives TLE too. so what should i do?
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.