콘솔창 & 윈도우창/코딩 테스트
프로그래머스 LV.2 N ^ 2 배열 자르기
뽀또치즈맛
2025. 4. 3. 23:00
CodingTest/프로그래머스/2/87390. n^2 배열 자르기 at main · kwon1232/CodingTest
This is an auto push repository for Baekjoon Online Judge created with [BaekjoonHub](https://github.com/BaekjoonHub/BaekjoonHub). - kwon1232/CodingTest
github.com

#include <string>
#include <vector>
using namespace std;
vector<int> solution(int n, long long left, long long right) {
vector<int> answer;
int row = left / n;
int col = left % n;
int count = right - left + 1;
for (int i = 1; i <= count; i++)
{
int num = max(row + 1, col + 1);
answer.push_back(num);
col++;
if(col == n)
{
row++;
col = 0;
}
}
return answer;
}
https://school.programmers.co.kr/learn/courses/30/lessons/87390