Handling Missing Values Before Pairplotting
Thornbury Labs sometimes loses a reading: an instrument times out and the field comes through as the text NA. The lab's rule is that a sample is only plotted if every one of its measurements survived, because a half-measured sample would appear in some panels and vanish from others, which readers find impossible to interpret. The caption states how many samples made it through.
Task: Print how many samples have no missing measurement.
Input
The first line holds one integer n, the number of samples, where 1 <= n <= 1000. Then come n lines, each holding a sample's a and b separated by a single space. Either field may be the text NA instead of a number, and both fields of a sample may be NA.
Output
One line holding a whole number: how many samples have a real value in both fields. A single missing field is enough to drop the whole sample.
Example:
Input:
4
1 2
NA 4
5 6
7 NA
Output:
2
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