처음엔 하드코딩으로 했는데 터져서 규칙을 찾았다.

#include <string>
#include <vector>
#include <algorithm>

using namespace std;

vector<int> solution(int n, long long left, long long right) {
    vector<int> answer;
    
    for (long long i = left; i <= right; i++)
        answer.push_back(max(i / n, i % n) + 1);

    return answer;
}

+ Recent posts