프로그래머스 181884 n보다 커질 때까지 더하기

1 개요[ | ]

프로그래머스 181884 n보다 커질 때까지 더하기

2 C++[ | ]

#include <string>
#include <vector>

using namespace std;

int solution(vector<int> numbers, int n) {
    int answer = 0;
    for(int number: numbers) {
        answer += number;
        if(answer>n) return answer;
    }
    return answer;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}