Make Unreal REAL.
article thumbnail
Level 0. 콜라츠 수열 만들기

 

 

#include <iostream>
#include <vector>

using namespace std;

vector<int> solution(int n)
{
    vector<int> answer {n};

    while (n != 1)
        answer.emplace_back(n += (n & 1) ? (2*n + 1) : -(n / 2));

    return answer;
}
profile

Make Unreal REAL.

@diesuki4

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!

검색 태그