주의 number % (n+m) 하면 안된다.

class Solution {
    public int solution(int number, int n, int m) {
        return number % n == 0 && number % m == 0 ? 1 : 0;
    }
}

'공부 > 프로그래머스' 카테고리의 다른 글

조건 문자열  (0) 2024.01.23
홀짝에 따라 다른 값 반환하기  (0) 2024.01.23
n의 배수  (0) 2024.01.23
두 수의 연산값 비교하기  (0) 2024.01.23
더 크게 합치기  (0) 2024.01.23

+ Recent posts