+ 1
[C Language] i don't know what's wrong with my code? Help me, please..
The question and my code in the link. https://code.sololearn.com/cpsUlFZAwcT6/?ref=app https://code.sololearn.com/c3UA3Rt0y94w/?ref=app
11 Respuestas
+ 3
Can I get the link to the original question ? ( just to make sure it isn't a part of any ongoing competition)
+ 3
Briana delete only the extra int declarations. Leave flag = 0 and flag = 1 there (without the int). Also clean up the characters before flag = 0.
+ 3
Briana Test case 2 works, as well. Yay!
There are warnings about unused variables p and r declared in line 5.
+ 1
Arsenic i don't know how to share. It's in microsoft word
+ 1
Lines 44 and 47 redefine flag as a local variable. Remove the int declarations, because it is already defined.
Also, in line 44 there is a spurious invisible character 302 between int and flag. Delete all characters on the line before flag.
After these fixes it appears to give correct output at least for the first test case. I did not try the second one.
+ 1
Brian i know.. I already remove other output.. But i don't know why it's keep say run error
0
Brian but, if I delete the flag, the 'yes' or 'no' appears m times. My code also keep give the output NO, even though it's YES
0
Brian it's work in my compiler.. But i don't know why the online judge say it's run error
0
Maybe it is expecting only YES or NO. The other outputs might be counted as wrong.
0
Briana I suspect the arrays h[100], s[100], u[100], and v[100] need to be larger. If N can be 100, my calculation says M can be as high as 4950, which requires those arrays to be that large, too.
0
Briana please also fix line 8. It needs correction to the upper limit check for m. (Needs m<=)