0
A run time error is there i cant find it
using namespace std; int main() { int m; cin>>m; int c[6654],d[224],l[4656],j; for(j=0;j<m;j++) { cin>>c[j]>>d[j]>>l[j]; if(l[j]==4*(c[j]+d[j])) { cout<<"yes"; } else if(l[j]==4*d[j]) { cout<<"yes"; } else if(l[j]==4*c[j]) { cout<<"yes"; } else { cout<<"no"; } } return 0; }
5 Réponses
+ 2
There's no runtime error when executing in code playground...
But I cannot guess/understand what for this code is???
Or would you mean there's 'runtime error' in meaning of not expected result?
So, you should say what's your expected result :P
+ 2
All that I can say, it's I was surprised when testing your code, that put '255' don't provoc an error, because the user input is stored in 'm' variable, which is used as max index for the 'j' iteration variable, used as index of the 3 arrays, from which one is sizing only 224... I not explain also why this arbitrary 3 differents sizes values, and for doing what?
+ 2
Oh, I can guess now the reason of the 3 arrays with particular size: however, I didn't want to search a solution, or an algoritm, but I suspect your runtime error is because the output ( return ) of your code didn't the one attempted ( it's suspicious that when running on sololearn code playground the output is only composed of "yes" ;) ). My advice is to improve your algoritm by verfying it here, and submit on contest when you'll be sure of the output...
0
i am playing in a code contest .when i submit this code a runtime error is there
0
here is a link of the problem
https://www.codechef.com/JAN17/problems/CATSDOGS