Beakjoon&프로그래머스/Java
[프로그래머스/Java] 원소들의 곱과 합
현장
2025. 2. 7. 19:22
-Code
class Solution {
public int solution(int[] num_list) {
int mul = 1;
int pow = 0;
for (int el : num_list) {
pow += el;
mul *= el;
}
pow = (int) Math.pow(pow, 2);
return pow > mul ? 1 : 0;
}
}