분류 전체보기 24

Big-O표기법, 왜 i *=2는 log₂n인가?

https://stackoverflow.com/questions/2307283/what-does-olog-n-mean-exactly What does O(log n) mean exactly? I am learning about Big O Notation running times and amortized times. I understand the notion of O(n) linear time, meaning that the size of the input affects the growth of the algorithm proportion... stackoverflow.com logn는 한 가지의 선택이 이루어질때마다 다른 선택들의 반을 지운다. 그것은 다음 연산이 1/2로 줄어든다는 걸 의미한다. htt..

카테고리 없음 2022.03.15

[프로그래머스] 연습문제 도장깨기

연습문제라고 나같은 사람들을 위한 아주~ 쉬운 문제들이 있더라? 그래서 풀어봄 직사각형 별찍기 https://programmers.co.kr/learn/courses/30/lessons/12969 코딩테스트 연습 - 직사각형 별찍기 이 문제에는 표준 입력으로 두 개의 정수 n과 m이 주어집니다. 별(*) 문자를 이용해 가로의 길이가 n, 세로의 길이가 m인 직사각형 형태를 출력해보세요. 제한 조건 n과 m은 각각 1000 이하인 자연수 programmers.co.kr #include int main(void) { int n = 0, m = 0; scanf("%d %d", &n, &m); for (int i = 1; i

C 2022.03.08

[프로그래머스] 두 정수 사이의 합

ㅎㅎ 쉬운 문제도 있구나 https://programmers.co.kr/learn/courses/30/lessons/12912 코딩테스트 연습 - 두 정수 사이의 합 두 정수 a, b가 주어졌을 때 a와 b 사이에 속한 모든 정수의 합을 리턴하는 함수, solution을 완성하세요. 예를 들어 a = 3, b = 5인 경우, 3 + 4 + 5 = 12이므로 12를 리턴합니다. 제한 조건 a와 b가 같은 경우 programmers.co.kr #include long long solution(int a, int b) { long long big = 0, small = 0, i = 0; if (a > b) { big = a; small = b; } else { big = b; small = a; } long ..

C 2022.03.08

[프로그래머스] 2016년

https://programmers.co.kr/learn/courses/30/lessons/12901# 코딩테스트 연습 - 2016년 2016년 1월 1일은 금요일입니다. 2016년 a월 b일은 무슨 요일일까요? 두 수 a ,b를 입력받아 2016년 a월 b일이 무슨 요일인지 리턴하는 함수, solution을 완성하세요. 요일의 이름은 일요일부터 토요일까 programmers.co.kr #include #include char* solution(int a, int b) { int month[13] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; int days[13] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };..

C 2022.03.06