처음엔 하드코딩으로 했는데 터져서 규칙을 찾았다.
#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;
}'Coding_Test 연습 > Programmers' 카테고리의 다른 글
| [프로그래머스] (C++) LV2 멀리 뛰기 (0) | 2022.06.09 |
|---|---|
| [프로그래머스] (C++) LV2 쿼드압축 후 개수 세기 (0) | 2022.06.08 |
| [프로그래머스] (C++) LV2 3 x n 타일링 (0) | 2022.06.04 |
| [프로그래머스] (C++) LV2 점프와 순간 이동 (0) | 2022.06.04 |
| [프로그래머스] (C++) LV2 이진 변환 반복하기 (0) | 2022.06.04 |