Wednesday, December 1, 2010

Challenge Problems SPOJ

KAMIL
for i in range(10):t=raw_input();print 2**sum(t.count(i)for i in'DFLT')

10.times{q=1 gets.gsub(/[DTFL]/){q*=2} p q}

1st one : python
2nd one : ruby


POLYBIUS
for i in range(input()):
for j in raw_input():
j=ord(j)
if j>73:j-=1
if j>64:print 2*j-j%5-119,

Language python

SUCCESS
main(){brk(printf("%m"));}

Language C

SIZECON
s=0;gets.to_i.times{b=gets.to_i;s+=b if b>0}
p s

Language ruby

3 comments:

  1. This is the worse thing one programmer can do. Why spoil others fun? If you are cocky about your golfing skill then write hints and tips on that, It will be appreciated. But supplying direct solutions to some particular tasks doesn't accomplish anything... :(

    ReplyDelete
  2. You learn by looking at others solutions'. Nobody directly searches for solutions. People try, spend time on optimizing and later search for better solutions. And then there are Anons like you who directly google for solutions.

    ReplyDelete
    Replies
    1. "there are Anons like you who directly google for solutions."
      This is the main reason of my frustration buddy.Its feels so great when you achieve a short code after struggling for hours scratching your head and discovering those tiny little improvement. But it feels bad when you see lots of submission that just accomplished by copy pasting other solution
      see the kamil's python rank list you will notice 96 solutions same as yours 71 byte. May be most of them is just copy pasting your code nothing else!
      I didn't meant to hurt you i just wanted to notice you the fact.
      Sharing hints and tips on code-golfing will provide all those that one can achieve seeing solution of others. It also provides spaces for creativity. But giving short solution spoils the fun of real coder...
      I hope you will get what i meant this time.

      Delete