https://www.acmicpc.net/problem/3052
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _3052
{
class Program
{
static void Main(string[] args)
{
var inputList = new List<int>();
for (int i = 0; i < 10; i++)
var remainList = new List<int>();
foreach (int num in inputList)
remainList.Add(num % 42);
int count = 1;
{
if (remainList[i] != remainList[i + 1])
count++;
}
Console.WriteLine(count);
}
}
}
|
숫자를 입력 받고 42로 나눈 나머지를 List에 넣었습니다.
나머지 List를 Sort하면 순서대로 나오게 되며 같은 값은 연속해서 나오게 됩니다.
순서대로 보며 같지 않을 때 카운트를 올려 출력하면 되겠습니다.
백준#1969 - DNA (0) | 2020.04.17 |
---|---|
백준#1449 - 수리공 항승 (0) | 2020.04.16 |
백준#1138 - 한 줄로 서기 (0) | 2020.04.13 |
백준#2529 - 부등호 (0) | 2020.04.12 |
백준#1049 - 기타줄 (0) | 2020.04.12 |