C++:: 프로그래머스 < 없는 숫자 더하기 >

jahlee·2023년 5월 26일
0

프로그래머스_Lv.1

목록 보기
32/75
post-thumbnail

간단히 1~9까지의 합인 45에서 주어지는 숫자들을 빼주면 되는 문제이다.

#include <string>
#include <vector>

using namespace std;

int solution(vector<int> numbers)
{
    int answer = 45;//1~9까지의 합
    for(auto number : numbers) answer -= number;
    return answer;
}

0개의 댓글