I am not sure if this is an IO issue or not but I couldn't think of anywhere else to put it. I have written a program that does the task here: http://cerberus.delos.com:790/usacoprob2?S=friday&a=fame6Eah0fH. However, it only ends up printing a series of 0's. I have been on this for hours and was hoping that someone else may be able to offer an insight as to what is wrong. I apologise for the ambiguity but I am really not sure what is wrong. There are no errors so it is likely just a flaw and, if so, I would appreciate advice on what it is. If this is in the wrong section I apologise and please move it. Thanks, Sam.
edit: the error shown on the USACO compiler and tester was this:
I have actually removed the 0's by removing the break!
However, it is still not right. Any ideas?
I have removed new line issue which was trivial(make it println) and have fixed what I believe to be an issue at
to stop it going a month ahead. This didn't fix it however. New error has replaced the old! P.s.I changed it at the other identical for loop also.
I have fixed a few bugs(added continues, fixed the 'day' value):
However, it is still not working with an error line of:
so I thought that as their output adds up to 12 for 1 13th of the month every month for a year, I should see what mine adds up to. It adds up to 311 which divided by 12 is 25.96 which I will put down to java type manipulation so Ill say that it does the equivalent of 26 years when it is meant to do one year. Therefore, I assume the issue is to do with the higher level stuff like the years. However,I still can't find the issue.
You need to debug your code and check that the values of all the variables are correct at every step through the program.
The easiest way to do this is with a debugger, but if you haven't used a debugger before it can be complicated.
It might be better to start off be just putting lots of print statements in your code to print out the values of the variables at various points in your program.
Hmmm, adding a print statement here and setting N to 1 which is what USACO inputs when it fails gives the the right answer. Even worse, their servers seem to be down or something because I cannot connect.
subject: PW printing nothing(may not be an io issue)