목록백준 (14)
컴공댕이 공부일지
백준 10814번 나이순 정렬 (실버 5) https://www.acmicpc.net/problem/10814 (정답 코드) #include #include #include using namespace std; typedef pair p; bool cmp(const p &a, const p &b) { // 나이순 정렬 if(a.first!=b.first) { return a.first < b.first; } // 나이가 같으면 변화없이 그대로 ! else { return false; // 원래 순서 유지 ! } } void sortUser(vector& user) { // 입력 순서를 보존하는 안정적인 정렬을 보장하는 sort_stable stable_sort(user.begin(), user.end()..

2023. 11. 3 일자 이화여대 알고리즘 튜터링 프로그램, 알튜비튜의 수업 내용 정리본입니다. 🔍이분 탐색 ( BinarySearch )이란 ? 업다운 게임을 생각하면 된다 ! 중간값과 찾아야하는 값을 비교해가며, 배열의 크기를 절반으로 줄이며 답을 찾는 알고리즘으로 반복문으로 구현하며, 시간 복잡도는 O(logN) 알고리즘 사용 전, 반드시 배열을 정렬해야 한다 !! +) 이분 탐색의 대상 원소들을 트리에 넣으면 바이너리서치트리(binary search tree) ! BST를 중위 순회 (inorder) 하면 정렬된 순서의 배열이 나온다. 이미지 출처 : https://velog.io/@reyang/C-%EC%84%A0%ED%98%95-%ED%83%90%EC%83%89-%EC%9D%B4%EC%A7%..

https://solved.ac/problems/sprout 1) 입력값의 합 출력하기 백준 1000번 #include int main() { int a,b=0; scanf("%d",&a); scanf("%d",&b); printf("%d", a+b); return 0; } 2) 입력값의 차 출력하기 백준 1001번 #include int main() { int a,b=0; scanf("%d",&a); scanf("%d",&b); printf("%d", a-b); return 0; } 3) 입력값의 곱 출력하기 백준 10998번 #include int main() { int a,b=0; scanf("%d",&a); scanf("%d",&b); printf("%d", a*b); return 0; } 4) ..
https://solved.ac/problems/sprout 1) Hello World 출력하기 2557번 #include int main() { printf("Hello World!"); return 0; } 2) 오늘 날짜 출력하기 10699번 #include int main() { printf("2022-08-31"); return 0; } 3) 내 아이디와 맞힌 문제 수 출력하기 7287번 #include int main() { printf("7\nsomi5488"); return 0; } 4) 고양이 그림 출력하기 10171번 #include int main() { printf("\\ /\\ \n ) ( \')\n( / ) \n \\(__)|"); return 0; } 5) 강아지 그림 출력하기..