Skip to content

Instantly share code, notes, and snippets.

@cshjin
Created February 23, 2015 21:07
Show Gist options
  • Save cshjin/ea5127ae023b47c2181e to your computer and use it in GitHub Desktop.
Save cshjin/ea5127ae023b47c2181e to your computer and use it in GitHub Desktop.
Code Jam Practice - Round 1A 2008
N = int(raw_input())
with open('outfile.txt', 'w') as outfile:
for test in range(N):
size = int(raw_input())
v1 = sorted(map(int, raw_input().split(" ")), reverse=True)
v2 = sorted(map(int, raw_input().split(" ")))
pro = 0
for i in range(size):
pro += v1[i] * v2[i]
outfile.write("Case #{}: ".format(test + 1) + str(pro) + "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment