Problem Description
假定一维整型数组a[n]中各元素值均在[0,200]区间内,编写一个算法,分别统计落在[0,20), [20,50), [50,80), [80,130), [130,200]各区间的元素数。
Input Description
第一行输入整数n,表示一维数组a[n]中元素的个数;
第二行输入在[0,200]区间中的n个整数,为数组a[n]中的各个元素。
Output Description
输出是5个整数,分别表示落在[0,20), [20,50), [50,80), [80,130), [130,200]各区间的元素个数。
Sample Input
8
123 78 12 63 87 195 169 23
Sample Output
1 1 2 2 2
#include <stdio.h>
int main()
{
int n;
int a[500];
int b[5] = {
0};//将所有元素初始化为零