💻
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 + (d * i));
}
return answer;
}
}
'프로그래머스 > Lv.0' 카테고리의 다른 글
[프로그래머스 C#] 인덱스 바꾸기 (0) | 2023.09.04 |
---|---|
[프로그래머스 C#] 개미 군단 (0) | 2023.09.04 |
[프로그래머스 C#] 접미사인지 확인하기 (0) | 2023.09.03 |
[프로그래머스 C#] n 번째 원소부터 (0) | 2023.09.03 |
[프로그래머스 C#] n개 간격의 원소들 (0) | 2023.09.03 |