Page 1 of 2

Starting Programming Challenges

PostPosted: Tue Feb 08, 2011 11:31 pm
by sam_2108
Hi,

This may sound dumb but i want to know how do you start the programming challenges. I have already completed challenge 1 successfully but the way i did it was copy the input string to my C program and den run the program. This method of copy paste usually takes a lot of time. I see that later programs have very small time and i can't copy paste everything in that time so there must be some other way in which you guys get the input to your programs. Can you please tell me how are you getting the input to your programs?

Re: Starting Programming Challenges

PostPosted: Tue Feb 08, 2011 11:40 pm
by fashizzlepop
Using the program to open the site, retrieve problem, solve, then submit.

Re: Starting Programming Challenges

PostPosted: Tue Feb 08, 2011 11:45 pm
by sam_2108
Do u mean sockets? Please clarify

Re: Starting Programming Challenges

PostPosted: Wed Feb 09, 2011 12:36 am
by fashizzlepop
If you are using C, you should be able to just request the site through a function, not sockets necessarily. I'm not that great with C, in PHP, for example, I'd use cURL. Or in Perl, CookieJar and an HTTP request module.

Re: Starting Programming Challenges

PostPosted: Wed Feb 09, 2011 1:05 am
by sam_2108
Thanks a lot for the info. I found a lib called libcurl which will assist me in the same. Off to understanding it :)

-- Thu Feb 10, 2011 2:07 am --

OK, i read cURL, even tried using it a couple of times but everytime the page fetched for challenge says - "You need to be logged on to use this". Am i doing something wrong. A push in right direction will be helpful. :(

Re: Starting Programming Challenges

PostPosted: Thu Feb 10, 2011 10:31 am
by Defience
Sounds like you need to handle your cookies.

Re: Starting Programming Challenges

PostPosted: Thu Feb 10, 2011 11:42 am
by fashizzlepop
Yes, HTS needs to know who you are in order to get the challenge, as well as submit it. Look up "cookiejar" and you will probably find something useful.

Re: Starting Programming Challenges

PostPosted: Thu Feb 10, 2011 3:26 pm
by unterbuchse
I wouldn't think that far. I mean you could do it that way but heres how i solved the time problem:

Just use the Clipboard. I mean set an event to the clipboard and then you only have to copy the input.
When copied to the Clipboard, your program solves the problem and writes it back to the clipboard. then you only have to press paste into the solution window and press enter to submit.

Re: Starting Programming Challenges

PostPosted: Thu Feb 10, 2011 5:05 pm
by Defience
unterbuchse wrote:I wouldn't think that far. I mean you could do it that way but heres how i solved the time problem:

Just use the Clipboard. I mean set an event to the clipboard and then you only have to copy the input.
When copied to the Clipboard, your program solves the problem and writes it back to the clipboard. then you only have to press paste into the solution window and press enter to submit.


It's much easier and quicker to have your code do it for you, especially for challenges that only give you 3 seconds to complete. The goal isn't to just complete the challenges but to learn how to program.

Re: Starting Programming Challenges

PostPosted: Thu Feb 10, 2011 5:48 pm
by unterbuchse
I think its fast enough if you just press copy and have the solution in clipboard.
and of course its good to learn programming but its also important that you see different sides of a problem and choose the one that is good in performance and easy to use.