Pie Chart
InterviewTime limit2sMemory limit256 MB
Given n numbers and a radius r, split the circle's area into sectors proportional to each number and print every sector's area.
- Level
Easy2 of 10
- Topics
- Math, Implementation, Array
- Solved
- No attempts yet
Problem
Graphs and charts of various kinds are used in many fields to depict the ratios between quantities of different sorts. One type of chart is the pie chart.
The input for a pie chart is a set of numbers , and the chart is a circle of radius divided into sectors. Each number corresponds to exactly one sector, whose area is proportional to that number. The total area of the sectors equals the area of the circle.
Given a set of numbers and the radius of the circle, determine the area of each sector of the pie chart.
Input
The first line contains two integers and (). The second line contains integers ( for all from to ).
Output
Print real numbers, the areas of the sectors corresponding to the numbers . Print each number on a separate line. All of these numbers must be printed with precision no worse than .