A run time error is there i cant find it | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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; }

8th Jan 2017, 6:36 AM
Pro
Pro - avatar
5 Answers
+ 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
8th Jan 2017, 7:00 AM
visph
visph - avatar
+ 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?
8th Jan 2017, 7:33 AM
visph
visph - avatar
+ 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...
8th Jan 2017, 7:50 AM
visph
visph - avatar
0
i am playing in a code contest .when i submit this code a runtime error is there
8th Jan 2017, 7:27 AM
Pro
Pro - avatar
8th Jan 2017, 7:38 AM
Pro
Pro - avatar