티스토리 뷰
딱히 뭐가 없다.
처음 받는 숫자는 필요없다.
두번째 받는 배열은 string[]에 Split()하여 받은 뒤, covertAll 하여 int[]에 저장한다.
세번째로 받은 값을 int[] 요소와 하나씩 비교하면서 count값을 증가할지를 결정한다.
BufferedStream bs = new BufferedStream(Console.OpenStandardInput());
StreamReader sr = new StreamReader(bs);
sr.ReadLine();
string[] stringNumber = sr.ReadLine().Split();
int[] number = Array.ConvertAll(stringNumber, int.Parse);
int vp = int.Parse(sr.ReadLine());
int cnt = 0;
foreach(int n in number)
{
if (n == vp)
cnt++;
}
Console.WriteLine(cnt); '■ 알고리즘 > ◻ 백준' 카테고리의 다른 글
| [C#]백준 10810번 : 공 넣기 (0) | 2018.08.14 |
|---|---|
| [C#]백준 10808번 : 알파벳 개수 (0) | 2018.08.14 |
| [C#]백준 3052번 : 나머지 (0) | 2018.08.14 |
| [C#]백준 2902번 : KMP? (0) | 2018.08.14 |
| [C#]백준 5430번 : AC (0) | 2018.08.14 |