티스토리 뷰
list<int> 생성해두고 10개의 값을 하나씩 받고 42로 나눈다음, Contain()을 이용해 list에 해당 값이 있는 지 검사한다.
없으면 저장한다.
이후 list.count 출력.
BufferedStream bs = new BufferedStream(Console.OpenStandardInput());
StreamReader sr = new StreamReader(bs);
List input = new List();
int value;
for(int i = 0; i<10; i++)
{
value = int.Parse(sr.ReadLine()) % 42;
if (!input.Contains(value))
input.Add(value);
}
Console.WriteLine(input.Count);
'■ 알고리즘 > ◻ 백준' 카테고리의 다른 글
| [C#]백준 10808번 : 알파벳 개수 (0) | 2018.08.14 |
|---|---|
| [C#]백준 10807번 : 개수 세기 (0) | 2018.08.14 |
| [C#]백준 2902번 : KMP? (0) | 2018.08.14 |
| [C#]백준 5430번 : AC (0) | 2018.08.14 |
| [C#/C++]백준 10809번 : 알파벳 찾기 (0) | 2018.08.14 |