There are N people P1, P2, P3, …, PN having F1, F2, F3, …, FN Facebook friends, respectively. The solution to this problem is finding k = Fi%Fj such that it is maximum over all valid i,j.
Answers
Answered by
1
Answer:
Explanation:
n=int(input())
f=[int(i) for i in input().split()]
max=0
for i in range(n):
for j in range(n):
k=f[i]%f[j]
if(k>max):
max=k
print(max,end="")
Answered by
0
Answer:n=int(input())
l=[int(i) for i in input().split()]
l.sort()
k1=[]
k2=[]
for i in range(0,len(l)):
for j in range(0,len(l)):
k1.append(l[i]%l[j])
for i in range(0,len(l)):
for j in range(0,len(l)):
k2.append(l[j]%l[i])
m1=max(k1)
m2=max(k2)
if(m1>m2):
print(m1)
else:
print(m2)
Explanation:
Similar questions
Business Studies,
6 months ago
Physics,
6 months ago
Computer Science,
6 months ago
Math,
1 year ago
Math,
1 year ago