Archive for August, 2008
GCJ 2008 - Round 1A: Minimum Scalar Product
This one was really really really too simple. The easiest problem of round 1. Unfortunately I didn’t took part at 1A, I did 1B and 1C and I did not pass :^( Anyway I’ll keep doing those problem just to have some fun :^)
def solve(a,b): a.sort() b.sort(reverse = True) return sum([i[0]*i[1] for i in zip(a,b)])
You have to pass a and b as lists, or if you prefer vectors… I think there is no more to comment here… I did it just thinking about it and I find the solution out in about 3 minutes, but I discovered that mathematicians already thought about that and gave it a name :^D
You can search on wikipedia for Rearrangement inequality. I mean, 4 lines of fully readable python… it was quite simple, wasn’t it?
return YAWN;
Tags: Coding, gcj, Google Code Jam
Symfony without ssh and pear
I’m currently working on a new project and I wanted to study something new to do it. It will be a web application, written in php. No matter what it will be useful for but I’ve found symfony, a great php framework. I read The Book in these 3 days, I’ll start tomorrow developing my app, I should be able to finish the model part in few days, I hope symfony helps :^)
Use it in local is quite simple, there are lot of tutorials and how-to on the symfony site. The painful part is to use it on a common hosting service.
In fact a very powerful tool of symfony is the command line interface, and you usually don’t have ssh support on your hosting service. There is a great tutorial here to make things work, and it’s quite simple, really! I did it today, now it’s working both on the server and on my pc. Look at it ;^)
return ‘bye’;
Tags: symfony