Showing posts with label SIZECON. Show all posts
Showing posts with label SIZECON. Show all posts

Wednesday, August 18, 2010

Update Ruby

I went through ruby tutorial due to some reasons and it turned out that using Ruby smaller codes can be written for challenge problems in spoj like KAMIL and SIZECON.

Results :

In problem KAMIL from size of 71 in python i jumped to 43 in Ruby.
Similarly, problem SIZECON reduced from 48 in python to 44 in Ruby.

Sunday, August 15, 2010

SIZECON

This is a challenge task in spoj. Link to the problem SIZECON
The best i could manage is 48 in python. Here's the source code:


q=0
w=input()
while w:
w-=1
a=input()
if a>0:q+=a
print q

if anyone has done better please share your approach :)