1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Maksim231197 [3]
3 years ago
6

You are given an array of integers "array []" and an input "x". you have to find if there are any two numbers in your array such

that the sum of their square equals to x2 . in other words, you have to find out if there is any pair of i,j such that array[i]2 + array[j]2 = x 2 . if there are such pairs, you should print all such (i,j). otherwise print "there are no such pairs". example: array []: 6, -4, 6, 3, 9, 0, -1, -9, 2, 6 x: 5 you have 1 pair: (-4) 2 + (3) 2 = 5 2 so, your output would be corresponding array indices: (1, 3) note: the array size is 10 and you have to get the elements of the array from
Mathematics
1 answer:
Vesnalui [34]3 years ago
3 0
Given an integer array a, size n, and an input integer value x..  Need to find all pairs of members a[i], a[j] such that (a[i],a[j],x) form a Pythagoras triplet, with x>a[i], a[j].

We need a double loop, the outer loop for a[i], and the inner loop finds a[j].
Here's a pseudocode.

int i, j, x, i2, x2, count=0; 
input x;
x2=x*x;   // economizing on cycles
if x<0 {x=-x};
for i=1 to n-1 {
  if x>=i {      // skip processing the impossible
    i2=i*i;      // economizing on cycles     
    for j=2 to n {
      if x>=j {     // skip processing the impossible
         if i2+j*j==x2 {
            count++;
            print(i,j);
         }
      }
    }
  }
}
if count==0 { print("there are no matched pairs");

It will have a similar complexity as a bubble sort, n^2/2.


You might be interested in
For a sample size of 120 and a sample proportion of 0.4, what is the standard
marta [7]

Answer:

c I think not sure juinji

5 0
3 years ago
Type the correct answer in each box. Use numerals instead of words.
sweet [91]
Answer: -(x + 3)^2 = 3

Explanation:

-x^2 - 6x + 6 = 0
-x^2 - 6x = -6
-x^2 - 6x + 9 = -6 + 9
-(x + 3)^2 = 3
6 0
4 years ago
Read 2 more answers
Skylar and Rodrigo each recorded how far they traveled while skateboarding. Skylar traveled 65 feet in 5 seconds and Rodrigo tra
Elena-2011 [213]
Skylar went 13ft per second
Rodrigo went 13 1/2 ft per second
So, 1/2 a ft per second
4 0
3 years ago
Verona goes to a business that offers tax refund anticipation loans because she really wants to get her money right now and not
natulia [17]

The annual percentage rate on the loan is 321%

<h3>Calculations and Parameters:</h3>

Using this formula

Annual percentage rate=(Fees/Refund)×(Numbers of days in a year/ Term of loan)

Annual percentage rate=(130/985)×(365 days/15 days)

Annual percentage rate=0.1319797×24.333×100

Annual percentage rate=321%

Therefore, the correct answer is option D.

Read more about APR here:

brainly.com/question/13906507

#SPJ4

5 0
2 years ago
Easy math (17 points))
zhenek [66]

Answer:

A-8.25  B-43.2 C-248.5

Step-by-step explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • Hank draws a line with a zero slope through the points (-2,4) and (3.b).which value of b could represent hanks second point ?
    9·2 answers
  • 5 poin
    14·2 answers
  • According toThe Humane Society in 2009 33% of US households owned at least one cat and 56% of households who did own cats owned
    12·1 answer
  • Simplify.<br> 8^-4 / 8^-10<br> A) 8^-14 <br> B) 8^-6 <br> C) 8^6 <br> D) 8^14
    6·2 answers
  • NEED HELP PLEASE PLEASE!!!!
    11·2 answers
  • The graph y = x squared - 3x + 4 is plotting on to a set of axes. What are the co-ordinates of where the graph crosses?
    6·1 answer
  • On saturday 1,164 people saw a movie at Upcity Theater 4 movie screens with the same number of audience About how many people wa
    5·1 answer
  • Find the area of the irregular figure. 5 in 6 in A = [ ? Jin.2 5 in 10 in 10 in 5 in​
    5·2 answers
  • I need to find the answer of it plz
    13·2 answers
  • HELP HELP DUE in 11 ahahhajs
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!