728x90
반응형
SMALL
#include <string>
#include <vector>
using namespace std;
int solution(int n) {
int answer = 0;
for(int i=1; i<n+1; i++)
answer += i%2==0 ? i:0;
return answer;
}
728x90
반응형
LIST
'C++' 카테고리의 다른 글
[프로그래머스] 짝수 홀수 개수 (0) | 2025.09.02 |
---|---|
[프로그래머스] 배열 뒤집기 (0) | 2025.09.02 |
[프로그래머스] 양꼬치 (0) | 2025.09.02 |
[프로그래머스] 배열의 평균값 (0) | 2025.09.02 |
[프로그래머스] 피자 나눠 먹기(3) (0) | 2025.09.02 |
댓글