-
-
Save kragniz/3251842 to your computer and use it in GitHub Desktop.
A2S 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import itertools | |
def f(a, b, c, d): | |
return a*b + b*c + c*d + a*d | |
greatest = 0 | |
for p in itertools.permutations([1,2,3,4]): | |
c = f(*p) | |
if c > greatest: | |
greatest = c | |
print greatest |
This was a solution for something at a taster day for southampton university. I avoided python hackery for readability, honest!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is this for? Googling "A2S" gives a malaria thing.