본문 바로가기

전체 글195

Codeforces Round #772 div2 A. Min or Sum Problem - A - Codeforces codeforces.com 배열 A가 있다. 배열의 원소를 다음과 같은 operation으로 바꿀 수 있다. For \(1 \leq i a_{i + 1}\) 라면 \.. 2022. 2. 21.
Codeforces Global Round 19 A. Sorting Parts Problem - A - Codeforces codeforces.com 길이 n인 array A를 consecutive한 두 partition [1 : i], [i + 1 : n]으로 나누어서 각각 정렬하였을 때, A는 정렬되지 않을 수 있는지를 물어보는 문제. i를 기점으로 왼쪽 부분에서는 max 값을, 오른쪽 부분에서는 min 값을 구하여 max 값이 min 값보다 크다면 가능함을, 그렇지 않으면 다른 i를 살펴보고 그런 i가 없다면 불가능함을 출력하였다. B. MEX and Array Problem - B - Codeforces codeforces.com 문제 설명은 문제 참조 (조금 복잡해서) 모든 subarray를 살피며 'subarray의 길이 + subarray.. 2022. 2. 14.
Educational Codeforces Round #122 늦었지만 올리는 후기 A. Div. 7 어떤 수 n 이 주어졌을 때, 숫자를 최소한으로 바꾸어 7으로 나뉘는 수를 구하는 문제. 바뀐 숫자는 0으로 시작하면 안된다. n과 자리수가 같은 7으로 나누어지는 수를 iteration하며 숫자가 다른 횟수를 센 후, 횟수가 가장 작은 수를 구하였다. 어차피 n이 최대 999라 brute force로도 충분했다. B. Minority 0과 1으로만 구성된 string이 주어졌을 때, substring의 minority의 최대 갯수를 구하는 문제. 여기서 minority란 substring 안에서 1의 갯수가 0보다 더 많으면 0, 0이 더 많으면 1이다. 갯수가 같은 경우 minority는 없다. 가장 큰 substring은 결국에 string 그 자체이다. 그래.. 2022. 2. 8.
I2C & SPI Serial communication protocols I2C - Inter-Integrated Circuit - Made by Philips - Good support to the slow devices, EEPROM, ADC, and RTC - Not only used with the single board but also used with the other external components which have connected with boards through the cables - A two-wire communication protocol, one used for the data (SDA, serial data), the other used for the clock (SCL, serial c.. 2022. 2. 7.