Computer Science, asked by 18981a05f4, 1 year ago

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 Bharathreddybbbb
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 chandrikasrisha3116
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