272 - TEX Quotes
Moderator: Board moderators
-
- New poster
- Posts: 10
- Joined: Mon Feb 25, 2008 8:22 pm
- Location: Dhaka, Bangladesh.
STill WA..
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....
Code: Select all
Removed After AC....
}
Last edited by Obaida on Tue Mar 04, 2008 9:23 am, edited 1 time in total.
try_try_try_try_&&&_try@try.com
This may be the address of success.
This may be the address of success.
Still WA..
SOme one help me.... I couldn't think.... Is there any problem in understanding the problem..... Why this gives WA...?
try_try_try_try_&&&_try@try.com
This may be the address of success.
This may be the address of success.
Check the cases.
Input:
Output:
Hope these help.
Input:
Code: Select all
"
"
"
"
Code: Select all
``
''
``
''
Easy...
[/code]
I thought it so complex.... Now an easy code get Ac....Ha...Ha...Ha...
I thought it so complex.... Now an easy code get Ac....Ha...Ha...Ha...
try_try_try_try_&&&_try@try.com
This may be the address of success.
This may be the address of success.
-
- New poster
- Posts: 12
- Joined: Fri May 23, 2008 10:24 pm
Re: 272 -Runtime Error-Plz help to debug it!!!
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
"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?
![:o](./images/smilies/icon_eek.gif)
regards
Re: 272 -WA-Plz help to debug it!!!
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?
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?
Code: Select all
Removed after AC
Last edited by hahahaken on Thu May 29, 2008 7:40 am, edited 1 time in total.
Re: 272 -WA-Plz help to debug it!!!
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.
All the best.
--Dread
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...
--Dread
Last edited by dreadlord on Thu Jun 05, 2008 1:13 pm, edited 1 time in total.
-
- New poster
- Posts: 12
- Joined: Fri May 23, 2008 10:24 pm
Re: 272 -WA-Plz help to debug it!!!
To: hahahaken
use numbers instead of '\''. You see the second apostrophe cancels the third one!
No you don't.Do I need to consider the spaces and newlines in the output?
![:D](./images/smilies/icon_biggrin.gif)
Change the code below :Why do I get wrong answer? Can anyone help take a look at it?
else if (s == '\'')
use numbers instead of '\''. You see the second apostrophe cancels the third one!
Re: 272 -WA-Plz help to debug it!!!
Still wrong answer, I hv changed the '\'' to char(39), but it doesn't work, why?
Code: Select all
Removed after AC
Last edited by hahahaken on Thu May 29, 2008 7:40 am, edited 1 time in total.
Re: 272 -WA-Plz help to debug it!!!
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?
![:cry:](./images/smilies/icon_cry.gif)
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?
Code: Select all
Removed after AC
Last edited by hahahaken on Thu May 29, 2008 7:41 am, edited 1 time in total.
Re: 272 -WA-Plz help to debug it!!!
hahahaken, I've made some tests with your last post code and I find two major problems: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?Code: Select all
...
- 1) You never get a space nor end of lines. Sentence: will always get the input in a "tokenized" fashion. Try to add
Code: Select all
cin >> s
just as the first loop sentence to see what it's actually getting.Code: Select all
cout << "<<" << s << ">>";
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.
I get the following output:this is just a "test" input
to check "hahahaken" 's program
Instead of:thisisjusta``test''inputtocheck``hahahaken'''sprogram
, which is the one it should give.this is just a ``test'' input
to check ``hahahaken'' 's program
Hope this help.
Re: 272 -WA-Plz help to debug it!!!
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.![:wink:](./images/smilies/icon_wink.gif)
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.
![:wink:](./images/smilies/icon_wink.gif)
Last edited by Obaida on Wed May 28, 2008 12:59 pm, edited 1 time in total.
try_try_try_try_&&&_try@try.com
This may be the address of success.
This may be the address of success.
Re: 272 -WA-Plz help to debug it!!!
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?
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?
Code: Select all
cout << "<<" << s << ">>";