Population vs. Average Temperature
Meridian Insight is scouting towns for an outdoor-equipment chain. A town is worth a site visit only if it is busier than average and warmer than average — either one on its own is no use to the client. Each town becomes a single dot, population across and temperature up, so clusters show at a glance. The scouting team wants the qualifying count printed under the picture.
Task: Print how many towns have a population strictly above the average population and, at the same time, a temperature strictly above the average temperature. Both averages are taken across the towns in this list and nothing else. A town sitting exactly on either average does not qualify.
Input
The first line holds an integer n, the number of towns. Each of the next n lines holds two numbers separated by a single space: that town's population, then its temperature. Both may have decimals. n is at least 1.
Output
One line holding a whole number: how many towns qualify.
Example:
Input:
3
100 60
200 80
50 70
Output:
1
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