A: The number of the same number as the specified number.
View and submit statistical questions.
Total time limit: 1000ms Memory limit: 65536kB
Description
Output the number of the same number as the specified number in an integer sequence.
Input The
input contains three lines: the
first line is N, which represents the length of the integer sequence (N <= 100); the
second line is N integers, separated by a space; the
third line contains an integer, which is the specified integer m .
Output The
output is the same number as m among the N numbers.
Sample input
3
2 3 2
2
Sample output
2
#include<iostream>
using namespace std;
int main()
{
long long n,i,m;
int a[101];
int j=0;
cin >> n;
for(i=1;i<=n;i++)
{
cin>>a[i];}
{
cin >> m;
for(int i=1;i<=n;i++)
if(a[i]==m)
{
j++;}
}
cout << j << endl;
return 0;
}