Computer Science, asked by kankipatikautilya1, 11 months 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 dubeyrohit1999
0

Answer:

n=int(input())  

l=list(map(int,input().split()))

maximum=0  

for i in range(0,n-1):  

 for j in range(1,n):  

   m=l[i]%l[j]  

    if m>maximum:  

     maximum=m

print(maximum,end='')

Explanation:

Answered by devoshree65
1

Answer:

n=int(input())

a=[int(x) for x in input().split(" ")]

l=len(a)

y=[]

for i in range(0,l):

   for j in range(0,l):

       if(i!=j):

           y.append(a[i]%a[j])

y.sort()

l2=len(y)

print(y[l2-1],end='')

Explanation:

Similar questions