Page 4 of 10
Posted: Sun Mar 02, 2008 10:12 am
by helloneo
You don't even pass the sample input..
See the sample output carefully..
Posted: Sun Mar 02, 2008 10:13 am
by CSEDU_1323
hi obaida,
initialize n=0 at d time of declaration
&&
use if(x==34&&s==1 )
instead if(x==34&&s==1&&i<length-1)
HOPE THIS HELP
STill WA..
Posted: Mon Mar 03, 2008 7:21 am
by Obaida
I edited my program... according jan's given input output.... This satisfy sample input and output... I took more coding to clear it out.....But still I got WA....
Still WA..
Posted: Mon Mar 03, 2008 7:59 am
by Obaida
SOme one help me.... I couldn't think.... Is there any problem in understanding the problem..... Why this gives WA...?
Posted: Mon Mar 03, 2008 3:47 pm
by Jan
Check the cases.
Input:
Output:
Hope these help.
Easy...
Posted: Tue Mar 04, 2008 9:20 am
by Obaida
[/code]
I thought it so complex.... Now an easy code get Ac....Ha...Ha...Ha...
Re: 272 -Runtime Error-Plz help to debug it!!!
Posted: Mon May 26, 2008 9:26 pm
by The_Madman
This is the program that i submitted to onlide judge. And as assumed(!) it replied with
"verdict Runtime error. This means that the execution of your program didn't finish properly. Remember to always terminate your code with the exit code 0."
Though all inputs and outputs are correct (as i guess) the main problem is when the strings get longer it crashes. Can anyone please tell how to solve it?
Yeah...yeah....solved it. Alhamdulillah!
was a string length problem.
like i let the string be determined in runtime, i.e., str[]={}
when i changed it to str[1000], i.e., in a fixed length the program executes and terminates successfully....and i got accepted.
can anyone explain this?? what if the length was greater than 1000?
regards
Re: 272 -WA-Plz help to debug it!!!
Posted: Tue May 27, 2008 10:49 am
by hahahaken
Do I need to consider the spaces and newlines in the output?
I have tried various methods to control the output but still don't manage to handle the spaces and newlines, but I think at most it should be presentation error
Why do I get wrong answer? Can anyone help take a look at it?
Re: 272 -WA-Plz help to debug it!!!
Posted: Tue May 27, 2008 4:14 pm
by dreadlord
This problem is extremely easy if one thinks in term of characters rather than lines.
WARNING: One program that gets AC follows (maybe not the best one in execution time, but AC). Do
not read it if you still feel this problem as a challenge.
Code: Select all
Removed. Looks like it's not a good practice at all to post AC code...
All the best.
--Dread
Re: 272 -WA-Plz help to debug it!!!
Posted: Tue May 27, 2008 8:17 pm
by The_Madman
To: hahahaken
Do I need to consider the spaces and newlines in the output?
No you don't.
Why do I get wrong answer? Can anyone help take a look at it?
Change the code below :
else if (s == '\'')
use numbers instead of '\''. You see the second apostrophe cancels the third one!
Re: 272 -WA-Plz help to debug it!!!
Posted: Wed May 28, 2008 6:05 am
by hahahaken
Still wrong answer, I hv changed the '\'' to char(39), but it doesn't work, why?
Re: 272 -WA-Plz help to debug it!!!
Posted: Wed May 28, 2008 6:28 am
by hahahaken
I have edited my code and submit a few times, but still wrong anssssss..., here's the lastest one, pls help
P.S. I've referred to the AC codes posted above, I think mine is similar to that, but I don't know what's wrong with mine
P.S.2 I have discovered that the single quotes should remain the same but my old version had changed the single quotes, that's why I got wrong ans, but even I have corrected this mistake, wrong answers still occur, why?
Re: 272 -WA-Plz help to debug it!!!
Posted: Wed May 28, 2008 12:36 pm
by dreadlord
hahahaken wrote:I have edited my code and submit a few times, but still wrong anssssss..., here's the lastest one, pls help
P.S. I've referred to the AC codes posted above, I think mine is similar to that, but I don't know what's wrong with mine
P.S.2 I have discovered that the single quotes should remain the same but my old version had changed the single quotes, that's why I got wrong ans, but even I have corrected this mistake, wrong answers still occur, why?
hahahaken, I've made some tests with your last post code and I find two major problems:
- 1) You never get a space nor end of lines. Sentence: will always get the input in a "tokenized" fashion. Try to add just as the first loop sentence to see what it's actually getting.
2) As a result of the above, you won't ever detect either spaces or end of lines, so that you won't ever write them out as you should.
If I run your program with the following input:
this is just a "test" input
to check "hahahaken" 's program
I get the following output:
thisisjusta``test''inputtocheck``hahahaken'''sprogram
Instead of:
this is just a ``test'' input
to check ``hahahaken'' 's program
, which is the one it should give.
Hope this help.
Re: 272 -WA-Plz help to debug it!!!
Posted: Wed May 28, 2008 12:58 pm
by Obaida
There is no trick in this problem. It's just straight forward.
read the string and run a loop from fast to last:
then if you find " then change to `` and if find " after `` then print ' ' else print that character.
to determine this things you can use a count initialized 0.
Increase count in every finding, When its even then print `` and when odd ' ' . very simple.

Re: 272 -WA-Plz help to debug it!!!
Posted: Wed May 28, 2008 12:59 pm
by hahahaken
Where should the below code added and what's the purpose?
I know how to output the spaces but I still don't manage to output line by line, I can just output a single continuous line, what else should I add?