Thursday, December 24, 2009

Spoj Sizecon Solution in Python

Recently while taking a break from my examination preparation i took a look at SIZECON question of spoj . My solution was of 93 characters in C++ which was not at all good. As i was learning Python I tried it and got solution of 50 characters. Here's my solution (the best in python is of 30 characters).

v=input()
s=0
while v>0:
i=input()
if i>0:s+=i
v-=1
print s

2 comments:

  1. cool solution though the best in python comes out in 30 characters.. :)

    ReplyDelete
  2. may be you can come up it with. try it !!

    ReplyDelete