Circular network
Practice
0 (0 votes)
Hard
Recruit
Number theory
Ready
Grammar Verified
Mathematics
Simulation
Approved
Factorization
Problem
100% Success 1 Attempts 50 Points 3s Time Limit 256MB Memory 1024 KB Max Code

You are given N parallel computers which are arranged in a circle to compute a huge task. Each computer is continuously executing a program of computing the average of a given set of real numbers, where the \(i^{th}\) computer is given \(D[i]\) integers initially.
An erroneous input went to each of the computers. Due to this extra input, the \(i^{th}\) computer is now calculating the average of \(D[i]+1\) numbers. The extra input is actually the geometric mean of the output of two adjacent computers.

Write a program to find the result shown by each of the computers.

Input format

  • First line: N
  • Next N lines: Integer \(D[i]\) followed by \(D[i]\) space-separated integers (denoting the set of numbers given to each computer)

Output format

Print N space separated real numbers exactly upto 4 decimal places . Each integer being the result shown by that computers.

Note:

  • The computers are running continuously.
  • All computers are independently running their program.
  • Circular arrangement means i and i+1 are adjacent where \(1\le i \le N-1\) ; 1 and N are adjacent.

Constraints

\(1 \le N \le 10^4 \)
\(1 \le D[i] \le 50 \)
\(1 \le actual\; input\; integers\; to\; i^{th}\; computer \le 1000 \)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:50
Tags:
HardNumber TheoryInteger factorizationData StructuresMathematicsSegment treeSieve
Points:50
Tags:
Hard
Points:50
1 votes
Tags:
MathematicsSieveHardNumber TheoryFactorization