Closed shreygupta2101 closed 2 years ago
I want to solve this issue. Please, assign this issue to me.
@shreygupta2101, Kindly add your solution to "codechef" folder. Deadline - 08/10/2021
This Issue will only be counted towards ranking criteria of this repository.
Gentle advice for futher Issues - Medium and hard level questions will be given preference for Hacktoberfest tag.
Enter your question -
Let's define a function P(x,y)=(x−y)2. For given real numbers a and b, let's define a polynomial Q a,b(x)=P(P(P(x,a),a−b),x−b).
Next, let's define a function F(a,b):
--> If Q a,b(x) has no real roots, F(a,b)=0. --> Otherwise, let r be the largest real root of Q a,b(x). --> If r is rational, it can be represented by a fraction r=p/q, where p and q are co-prime integers and q>0. Then, F(a,b)=p+q. --> If r is irrational, it can be proved that in this case, it can be represented in the form r=(p+√z)/q, where p, q and z are integers, q>0 and z>0. Choose the representation with the smallest value of q (it is guaranteed to be unique in this case). Then, F(a,b)=p+z+q.
You are given a sequence of integers c1,c2,…,cN. Find ∑Ni=1∑Nj=1F(ci,cj).
Enter link to the question(if question belongs to any online platform) -
https://www.codechef.com/problems/POLYRT
Tags for the question(eg - Array, Basic, Stack, etc.) -
math #prefix-sum