The number of the same number as the specified number

1: The number of the same number as the specified number

Total time limit: 
1000ms
Memory limit: 
65536kB
describe

Outputs the number of integers in a sequence that have the same number as the specified number.

enter
The input contains three lines:
the first line is N, which represents the length of the integer sequence (N <= 100);
the second line contains N integers, separated by a space;
the third line contains an integer, which is the specified integer m.
output
The output is the number of N numbers that are the same as m.
sample input
3
2 3 2
2
Sample output
2















#include<iostream>
using namespace std;
int main(){
	const int MAX = 101;
	int a[MAX];
	int n,m,count=0;
	
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	cin>>m;
	
	for(int i=0;i<n;i++){
		if(a[i]==m) count++;
	}	
		
	cout<<count<<endl;
	return 0;
}

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326851887&siteId=291194637