Scaling Elements for Presentations With set_context
Marlow & Finch are rebuilding a client's charts for a conference stage, where the same figure has to be legible from the back of a room. Fonts, line weights and marker sizes all scale up together for that; the scatter of paired readings stays exactly as it was. The speaker notes carry the strength of the relationship as a number, because a scatter on a screen is read very differently from a scatter on a desk.
Task: Print the correlation between the x column and the y column.
Input
The first line holds one integer n, the number of readings, where 2 <= n <= 1000. Then come n lines, each holding a reading's x and y separated by a single space. Neither column is the same value throughout.
Output
One line holding the Pearson correlation of x and y -- the ordinary straight-line one, running from -1 for a perfect fall through 0 for no straight-line link to +1 for a perfect rise -- rounded to 2 decimal places.
Example:
Input:
3
1 10
2 20
3 30
Output:
1.00
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in