Hi Paul, In the code 'n' is declared as an integer. Hence, it would be round to the nearest lower value. For example, if the equation provides something as 2.6, it would be round to 'n' = 2.
Using floating point for n is not logical, as one cannot buy a fraction of a farm... I have used cout to display on my terminal, while the following line would write it to the output file... However, I'm don't entirely disagree with you. The output file format might have been a little different, as I remember, when I was practising with previous questions, the system didn't accept my output because there was one space less in the output. However, in this case, I couldn't understand the problem as I copy pasted the format from the problem it self. On Wednesday, April 16, 2014 6:02:49 AM UTC-4, Paul Smith wrote: > My knowledge of C++ isn't exactly at expert level, but: > > > 1) In the line int n = (X/C) - (CPS/F); are you getting the rounding > behaviour that you're expecting? > > > 2) Have you tried defining CPS as the floating point value 2.0f instead of > the integer value 2? > 3) It's also strange that you're writing differently to cout and to outfile, > but I'm sure you would have realised if that was you're problem (Most people > I think use cout for the output, and use shell redirection to redirect stdout > to a file when submitting. Your debug output can go to cerr instead. > > > > > Paul Smith > > [email protected] > > > > On Tue, Apr 15, 2014 at 11:39 PM, Cristi Mihai <[email protected]> wrote: > > > If you're still dying to find out what tests you failed, I would download > someone else's implementation and run it through the test case, and then run > yours, and do a diff / text compare on the 2 outputs and you'll see which one > you failed. > > > > > > > -- > > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > > To post to this group, send email to [email protected]. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-code/4c8c581e-44e7-4771-9719-dc1a5fba8fde%40googlegroups.com. > > > > > > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/9daaf990-cb35-420c-83c8-fda32d8acd19%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
