티스토리 뷰

💡 나의 풀이
채점 결과
정확성: 100.0
합계: 100.0 / 100.0
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
|
class Solution {
public boolean solution(int x) {
boolean answer = false;
int inputNum = x;
int sum = 0;
while(inputNum/10 != 0) {
sum += inputNum % 10;
inputNum /= 10;
}
sum += inputNum;
if(x % sum == 0) {
answer = true;
}
System.out.println("각 자리수 합 : " + sum);
return answer;
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
'👩🏻💻 기술면접 > 알고리즘' 카테고리의 다른 글
[프로그래머스] Java 모의고사 Level 1 (0) | 2020.04.02 |
---|---|
[프로그래머스] Java x만큼 간격이 있는 n개의 숫자 Level 1 (0) | 2020.04.02 |
[프로그래머스] Java 이상한 문자 만들기 Level 1 (1) | 2020.04.02 |
[프로그래머스] Java 문자열 다루기 기본 Level 1 (0) | 2020.04.01 |
[프로그래머스] Java 문자열 내림차순 배치하기 Level 1 (0) | 2020.04.01 |
댓글