We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Itertools
- Maximize It!
- Discussions
Maximize It!
Maximize It!
Sort by
recency
|
1038 Discussions
|
Please Login in order to post a comment
This line in the instructions is not well written:
The first number in every line is size of the array that follows. WHY!!!!
Whoever wrote that needs to take a course on communications. They may be a good engineer, but they're not good at explaining things in a way that students will understand.
from itertools import product
s=input().split()
q=[]
e=0
for _ in range(int(s[0])):
q.append(list(map(int,input().split())))
for i in list(product(*q)):
a=0
for o in i:
a=o*o+a
if a%int(s[1])>e:
e=a%int(s[1]) print(e) print(e)