C++

DongGeon Gwak·2025년 7월 9일

C++

목록 보기
17/17
#include <string>
#include <vector>

using namespace std;

int solution(vector<int> absolutes, vector<bool> signs) {
    int a = 0;
    int b = 0;
    
    
    for(int i = 0; i < absolutes.size(); i++)
    {
        if(signs[i] == true)
        {
            a += absolutes[i];
        }
        else
        {
            b += absolutes[i] * (-1);
        }
    }
    
    return a + b;
}
profile
아싸라비야

0개의 댓글