[C#] 백준 10807번 : 개수 세기
using System;
class Program
{
static void Main()
{
int n = int.Parse(Console.ReadLine()); // 입력값이 단일 정수인 경우
int[] numbers = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); // 입력값이 여러 정수이고, 공백으로 구분된 경우
int target = int.Parse(Console.ReadLine());
int count = 0;
for (int i = 0; i < numbers.Length; i++)
{
if (numbers[i] == target)
{
count++;
}
}
Console.WriteLine(count);
}
}
반응형
'백준 > C#' 카테고리의 다른 글
[C#] 백준 10818번 : 최소, 최대 (0) | 2025.01.24 |
---|---|
[C#] 백준 10871번 : X보다 작은 수 (0) | 2025.01.24 |
[C#] 백준 10951번 : A+B - 4 (0) | 2025.01.23 |
[C#] 백준 10952번 : A+B - 5 (0) | 2025.01.23 |
[C#] 백준 2439번 : 별 찍기 - 2 (0) | 2025.01.23 |