Math, asked by gokul37221, 1 year ago

You have given n positive numbers a1 a2 an and you have to calculate the total sum of floor

Answers

Answered by Anonymous
9

Given an array of n integers, find the sum of f(a[i], a[j]) of all pairs (i, j) such that (1 <= i < j <= n).

f(a[i], a[j]):


If |a[j]-a[i]| > 1

f(a[i], a[j]) = a[j] - a[i]

Else // if |a[j]-a[i]| <= 1

f(a[i], a[j]) = 0


I hope this will help you

If not then comment me


Anonymous: wow Bhaiyya...kya answer h
Anonymous: Very nice
Answered by Anonymous
8
HEY MATE,

f( a(i),a(j) ) :


if... a(j)-a(I) >1
f ( a(I), a(j) = a(j)- a(I)

Else // if a(j)-a(I)<=1

f(I), f(j) = 0

I HOPE IT'S HELP YOU

Anonymous: Hehehe
Anonymous: Varun bhi mere Bhaiyya h...
Anonymous: mere answer me jinhone thanks kiya h...smartyaryan id se
Anonymous: Sahil Bhaiyya aapke liye new friend ... hehehe
Anonymous: Arey Varun Bhaiyya kaha gaye???
Anonymous: BTW ....gud night Bhaiyya
Anonymous: Good morning Varun Bhaiyya
Anonymous: i hate you Bhaiyya
Anonymous: katti
Similar questions