250712

lililllilillll·2025년 7월 11일

개발 일지

목록 보기
230/350

✅ What I did today


  • 프로그래머스
  • 데브시스터즈 코테 : 2/3솔
    • 웹 자체 ide 절대 쓰지 말고 visual studio로만 작성할 것
    • 최소 우선순위 큐 선언할 때 자료형 int 아니면 다른 것도 int에서 바꿔줘야 함
    • 조금 절어도 시간 많으니까 침착하게 문제 처음부터 끝까지 다 읽고 풀 것
    • 무지성으로 인덱스 작성하지 말고 접근하는 인덱스가 무슨 의미인지 생각하기
    • 분명 다른거 전부 double로 선언돼있는데도 손 나가는대로 변수를 int로 선언해버리지 말기
  • Atcoder


⚔️ 프로그래머스


하노이의 탑

#include <string>
#include <vector>

using namespace std;

vector<vector<int>> hanoi(int disk, int from, int to)
{
    // disk 개를 from에서 to로 옮기는데 필요한 원판 이동
    if (disk == 1) return { {from,to} };

    vector<vector<int>> res;
    for (vector<int> move : hanoi(disk - 1, from, 6 - from - to)) {
        res.push_back(move);
    }
    res.push_back({from,to});
    for (vector<int> move : hanoi(disk - 1, 6 - from - to, to)) {
        res.push_back(move);
    }
    return res;
}

vector<vector<int>> solution(int n) {
    return hanoi(n, 1, 3);
}


profile
너 정말 **핵심**을 찔렀어

0개의 댓글