using System;
public class Solution {
public int solution(int a, int d, bool[] included) {
int answer = 0;
for(int i = 0; i<included.Length;i++)
{
if(included[i])
{
answer += (a + i * d);
}
}
return answer;
}
}
'코딩 테스트 > Lv.0' 카테고리의 다른 글
원소들의 곱과 합 (0) | 2025.01.13 |
---|---|
주사위 게임 2 (0) | 2025.01.13 |
flag 값에 따라 다른 값 반환하기 (0) | 2025.01.03 |
홀짝에 따라 다른 값 반환하기 (0) | 2025.01.02 |
공배수 (1) | 2025.01.02 |