From 444b7daddad0707a05a1f6ed84010784d0038ef8 Mon Sep 17 00:00:00 2001 From: Sakshi Agrawal <66746828+SakshiiAgrawal@users.noreply.github.com> Date: Thu, 22 Oct 2020 13:03:01 +0530 Subject: [PATCH] hackerrank solution --- Hackerrank-Maximize it!/Maximize it!.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Hackerrank-Maximize it!/Maximize it!.py diff --git a/Hackerrank-Maximize it!/Maximize it!.py b/Hackerrank-Maximize it!/Maximize it!.py new file mode 100644 index 0000000..75a0bd0 --- /dev/null +++ b/Hackerrank-Maximize it!/Maximize it!.py @@ -0,0 +1,17 @@ +# contributed by Sakshi Agrawal +from itertools import product +x, m = map(int, input().split()) +l = [] +p = [] +q = [] +sum = 0 +for i in range(x): + l.append(list(map(int,input().split()))) + l[i].remove(l[i][0]) +p = list(product(*l)) +for i in range(len(p)): + sum = 0 + for j in range(x): + sum += pow(p[i][j], 2) + q.append(sum%m) +print(max(q))
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: