알고리즘

[알고리즘] 진법 변환하는 방법_3진법(whatever)

seulhasony 2024. 1. 24. 16:27

https://school.programmers.co.kr/learn/courses/30/lessons/68935

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr

 

솔루션

https://gist.github.com/KimSeulHa/0216bfc2c17a53fb36d673c87dea22df

 

진법 변환 방법_ex)3진법

진법 변환 방법_ex)3진법. GitHub Gist: instantly share code, notes, and snippets.

gist.github.com

중요 메소드

1.정수를 3진법으로

String str = Integer.toString(n,3);

2. 3진법을 10진법으로

int num = Integer.valueOf(n,3);