Description
A Cong took fish balls to see the apple tree that Newton was hit by. At this time, an apple fell down from the tree, the fish balls are so angry that she wants to pick up all the apples on the tree!
Here we will give a Cong's height h_boy and weight w_boy, the height of the fish ball h_girl and the weight of the w_girl. When a Cong's weight is higher than that of the fish ball, the fish ball can stand on a Cong to pick up the apple, if the fish balls are too fat, there is no way> _ <
As long as the height of an apple is not higher than that of a fish ball, the fish ball can take it off!
-
Input
-
T group data.
For each group of data: the first line first gives n, h_boy, w_boy, h_girl, and w_girl. N indicates a total of N apples. Other variables have the same meanings as the topic description. The second row contains N numbers, representing the height of N Apples (T <= 10, n <1000, h_boy, w_boy, h_girl, and w_girl). For details, see normal human data, the unit of height is cm, the unit of weight is kg, and the height of apple is a positive integer and within 500, in cm)
-
Output
-
For each group of data, output a line indicating that the fish balls can pick up several apples
-
Sample Input
-
2
10 172 55 160 49
300 330 120 90 170 160 220 400 50 500
10 172 55 160 56
300 330 120 90 170 160 220 400 50 500
-
Sample output
-
8
4
Simulate the question and compare the height.
#include <stdio.h>int main(){int number,t;int n,hb,wb,hg,wg;int a[1005],i;int count;scanf("%d",&number);for(t=1;t<=number;t++){count=0;scanf("%d %d %d %d %d",&n,&hb,&wb,&hg,&wg);for(i=0;i<n;i++)scanf("%d",&a[i]);for(i=0;i<n;i++){if((wb>wg)&&((hb+hg)>=a[i]))count++;if((wb<=wg)&&(hg>=a[i]))count++;}printf("%d\n",count);}return 0;}