Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| 31 |
Tags
- 러닝일지
- BOJ
- dfs
- 백준
- MySQL
- 코테
- DP
- 코딩테스트
- SQL
- 시뮬레이션
- db
- COS PRO
- 문제해결
- 투포인터
- 문자열
- math
- 이분탐색
- oracle
- 운동기록
- 알고리즘
- 건강
- binary search
- priorityqueue
- SWEA
- Java
- greedy
- BFS
- 자바
- 문제풀이
- 프로그래머스
Archives
- Today
- Total
슈콩
[프로그래머스] Lv.2 [3차] n진수 게임 본문



[문제]
https://school.programmers.co.kr/learn/courses/30/lessons/17687#qna
프로그래머스
SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프
programmers.co.kr
[소스 코드]
class Solution {
public String solution(int n, int t, int m, int p) {
String answer = "";
int num = 0;
int order = 1;
int cnt = 0;
while(cnt<t){
String currNum = Integer.toString(num,n).toUpperCase();
for(char c : currNum.toCharArray()){
if(order==m+1) order = 1;
if(p==order){
answer += c;
cnt++;
if(cnt==t) break;
}
order++;
}
num++;
}
return answer;
}
}'Algorithms > Programmers' 카테고리의 다른 글
| [프로그래머스] Lv.2 주식가격 (0) | 2025.10.16 |
|---|---|
| [프로그래머스] Lv.2 더 맵게 (0) | 2025.10.16 |
| [프로그래머스] Lv.2 k진수에서 소수 개수 구하기 (0) | 2025.10.16 |
| [프로그래머스] Lv.2 뒤에 있는 큰 수 찾기 (0) | 2025.10.16 |
| [프로그래머스] Lv.2 모음사전 (0) | 2025.10.16 |