728x90
SMALL

using System;

public class Solution {
    public int solution(int[] box, int n) {
        int answer = 0;
        answer += box[0]/n;
        answer *= box[1]/n;
        answer *= box[2]/n;
        return answer;
    }
}

 

파이썬

 

def solution(box, n):
    x, y, z = box
    return (x // n) * (y // n) * (z // n )

 

자바

 

class Solution {
    public int solution(int[] box, int n) {
        int answer = 1;

        answer *= box[0]/n;
        answer *= box[1]/n;
        answer *= box[2]/n;

        return answer;
    }
}

 

 

 

자바

 

 

class Solution {
    public int solution(int[] box, int n) {
        int answer = 1;

        answer *= box[0]/n;
        answer *= box[1]/n;
        answer *= box[2]/n;

        return answer;
    }
}

 

 

class Solution {
    public int solution(int[] box, int n) {
        int answer = 0;
        
        for(int length : box)
        {
            if(answer == 0)
            {
                answer = length / n;
            }
            else
            {
                answer *= length / n;
            }
        }
        return answer;
    }
}

 

 

class Solution {
    public int solution(int[] box, int n) {
        int answer = (box[0] / n) * (box[1] / n) * (box[2] / n);

        return answer;
    }
}
728x90

설정

트랙백

댓글