Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [CCC] Do you need to handle invalid input?
Index -> Contests
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
riveryu




PostPosted: Sat Aug 23, 2008 11:52 am   Post subject: [CCC] Do you need to handle invalid input?

[CCC] Do you need to handle invalid input?

For example if a question stated 2 input variables (x,y) and specified range of (1<x<5) and (1<y<5).
Do you have to test for invalid input exception?
That is, in your solution code do you have to include something like:
Java:

if (x <1 || x>5 || y <1 || y > 5 )
System.out.print("Error:you suck");
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sat Aug 23, 2008 12:02 pm   Post subject: RE:[CCC] Do you need to handle invalid input?

No.

If the question says that the input will be within a certain range, it will be within that range.

That is, unless the question specifically says otherwise.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
riveryu




PostPosted: Sun Aug 24, 2008 5:05 pm   Post subject: RE:[CCC] Do you need to handle invalid input?

O, alright thanks. Have you tried Junior CCC, what advice would you give ? Also, I've another question.

How is your solution means judged ?

If the problem can be solved with both recursion and iteration, will recursion be more favored by the judges?

Or, are the problems always made in a way so that only one approach may work to the conditions?
Tony




PostPosted: Sun Aug 24, 2008 5:14 pm   Post subject: Re: RE:[CCC] Do you need to handle invalid input?

riveryu @ Sun Aug 24, 2008 5:05 pm wrote:
Have you tried Junior CCC, what advice would you give?

Check out the practice questions to see what kind of problems you should be able to solve. Aim to learn algorithms, patterns, ideas; not memorizing a solution to a particular problem.

Practice by taking part in the DWITE rounds.

The solutions are judged based on the accuracy of the output; though there's always a requirement for the program to execute in a "reasonable time" (few seconds tops), so sometimes the data range (the "N up to [some large number]" part) will dictate one approach over another for full marks (that is, you could score partial points for small cases with an inefficient solution, and time out on larger sets).
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
nike52




PostPosted: Sun Aug 24, 2008 5:26 pm   Post subject: Re: [CCC] Do you need to handle invalid input?

Sometimes the problem has one approach, two, or even three, but one approach to the problem is the most common.
http://access.mmhs.ca/ccc/index.htm

Advice? Try the problems on your own. If you get stuck, look at the solutions until you're able to attempt the problem on your own again. Read the different solutions to the problems. Expect to spend a lot of time learning how to solve certain problems before you even start worrying about how quick you can do them. Problems where you looked significantly at the solutions, do them again when you feel you've forgotten most of the steps to solve the solution. And if you want, there are also more tips you can find with a simple search. Spend a lot time practicing for the ccc, and you'll do fine.
riveryu




PostPosted: Sun Aug 24, 2008 8:16 pm   Post subject: RE:[CCC] Do you need to handle invalid input?

Thanks a lot guys, I'm gonna practice old CCCs now.
Display posts from previous:   
   Index -> Contests
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: