반응형 [PCCP] Lv2: 예상 대진표(12985) 해설 문제- 문제 링크: 예상 대진표 해설- 자료구조: - 시간복잡도: (풀이과정)1) 2) 3) 4) 코드(C언어)solution 1)더보기solution 1#includesolution 2)더보기#includesolution 3)더보기#include (C++)solution 1)- N: 참가한 인원 수- 같은 번호가 될 때까지 계속해서 2로 나누는 연산: O(logN)더보기#include using namespace std;int solution(int n, int a, int b){ int answer = 0; do { a = (a + 1) / 2; b = (b + 1) / 2; ++answer; } while (a != b); return .. 2024. 12. 24. 이전 1 다음 반응형