Algorithm

BOJ 10807 개수 세기 c++

최강훈 2020. 8. 14. 20:43

BOJ 10807 개수 세기 c++

백준 10807 개수 세기 c++


#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    int arr[105];
    int target;
    int ans = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    cin >> target;
    for (int i = 0; i < n; i++) {
        if (arr[i] == target)
            ans++;
    }
    cout << ans;
}