[프로그래머스] 등차수열의 특정한 항만 더하기

Seah Lee·2023년 6월 20일
0

프로그래머스

목록 보기
15/57

class Solution {
    public int solution(int a, int d, boolean[] included) {
        int answer = 0;
        
        for (int i=0;i<included.length;i++) {
            if(included[i]==true) answer += a+i*d; 
        }
        return answer;
    }
}

어우 앞에 코드 문제 푸는거 오래걸려서 쫄았는데 오래 안걸리는 문제였다 다행 !

profile
성장하는 개발자

0개의 댓글