Agree with Neal
To read till the end of file, I would suggest to use
while (cin >> str1 >> str2) {
..
}
and then there is no need to take care of the last 'endl'.
the following code give me accepted.
http://ideone.com/ORzXcK
Parker
On 2012/12/13 13:34, Neal Zane wrote:
Not sure but could be the last 'endl' for the last line you
intentionally avoided. Note that UVa reports WA on mis-formatting,
insteadof PE (long ago since host migration).
The while loop judging cin.eof() could also fail it if the input file
has extra lines that althoughthe test cases are read but in the tail
there are some blanks, cin.eof() is true and you are still running and
the output could be corrupted.It's safer to use just:
while (cin >> str1 >> str2) {
..
}
The code logic looks fine to me(hard to tell though, UVa is lining up
judging queuefor now.)
Regards
On Thu, Dec 13, 2012 at 11:55 AM, thefourtheye dIVi
<[email protected] <mailto:[email protected]>>
wrote:
Hi,
I believe it is a very simple problem but still getting WA... :(
Could you anyone please help me spotting the mistake?
http://ideone.com/dAsYdK
--
You received this message because you are subscribed to the Google
Groups "Google Code Jam" group.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
To unsubscribe from this group, send email to
[email protected]
<mailto:google-code%[email protected]>.
For more options, visit https://groups.google.com/groups/opt_out.
--
8-)
--
You received this message because you are subscribed to the Google
Groups "Google Code Jam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "Google
Code Jam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.