반응형
2022.07.29 - [Coding Test/Python] - [프로그래머스] 음양 더하기 Python3 code
[프로그래머스] 음양 더하기 Python3 code
스킬 체크만 하고 프로그래머스를 많이 이용하지 않아서 그런지 추천 문제에 레벨 1이 많이 떠서 얼른 해치우려고 한다. 우선 python3로 풀이해봤다. 문제 Code 너무 쉽기 때문에 바로 코드를 올리
gm-note.tistory.com
저번 python에 이어
이번엔 C++로 풀이해봤다.
문제
Code
#include <string>
#include <vector>
using namespace std;
int solution(vector<int> absolutes, vector<bool> signs) {
int answer = 0;
for(int i = 0; i < signs.size(); i++) {
if(signs[i])
answer += absolutes[i];
else
answer -= absolutes[i];
}
return answer;
}
반응형
'Coding Test > C++' 카테고리의 다른 글
[프로그래머스] 없는 숫자 더하기 C++ Code (0) | 2022.08.08 |
---|---|
[프로그래머스] 소수 만들기 C++ Code (0) | 2022.08.04 |
[프로그래머스] 내적 C++ Code (0) | 2022.07.29 |
[프로그래머스] 폰켓몬 C++ Code (0) | 2022.07.29 |
[프로그래머스] 신고 결과 받기 C++ Code (0) | 2022.07.16 |
댓글