The Programming Contests, Challenges and Online Judge Thread.

QwertyManiac

Commander in Chief
Can someone post a simple example of how an SPOJ submission should take input as.

Is it via STDIN or via a file? A sample solution that reads one test case amount line, and a test case is enough. Python preferrably. :)
 
OP
Sykora

Sykora

I see right through you.
@Qwerty :

I think it is mentioned on all problems that input is taken from stdin. However, it is obvious that the input is redirected from a file, and stdout is redirected to a file.

The general construct is this :

Code:
numTestCases = int(input())
for i in range(numTestCases) :
    # Do stuff here
    #
    #

    print(result)

No, I don't store the results and print them out later, because it doesn't make a difference to the judge, and you gain time _and_ space.
 

QwertyManiac

Commander in Chief
Thank you for clearing it up! I had got confused about it actually. And thanks for the efficiency tip too. :)

Btw, doesn't input() automatically convert to int on passing an input w/o quotes?
 
OP
Sykora

Sykora

I see right through you.
^^^ I've gotten used to python3.0 where raw_input() became input, and input was removed in favor of eval(input).
 

QwertyManiac

Commander in Chief
Current Contests (To be held today, the 9th of March):

1. Anna University's CodeArena @ SPOJ.pl (Contest Ended at 18:00 Hours)
--------------Allowed Languages: Many (C/C++, Java, Ruby and Python inclusive.)

2. IIITM Gwalior's Code Weavers (Contest Ended at 1800 Hours)
--------------Allowed Languages: Restricted (C/C++, Java)

Both events have team participation as well, so good luck all!

Another good problem resource (Eternal):

IIT-K's Bitwise Annual Algorithm Challenge
(Its over for this year already, but problems remain, from every Bitwise there ever was. Very good problems!)
 
Last edited:
OP
Sykora

Sykora

I see right through you.
The SPOJ Open Contest 2008 is now running, from May 3 to 20.

You can find it at *www.spoj.pl/ZFUN08/ .
 

QwertyManiac

Commander in Chief
I did the BCH problem there, got a chain of 968 numbers / 1061 maximum :( Will try that one again in this week to max out.
 

aditya.shevade

Console Junkie
hehe... no one will give you answers... you can ask for hints... but not answers directly... and PLEASE do not post answers.
 
Top Bottom