Skip to content

Commit

Permalink
solve(programmers): LV0_길이에 따른 연산_c++
Browse files Browse the repository at this point in the history
# id: 문제 id를 숫자로 작성
# categories : 해당 문제의 유형을 ,로 구분하여 작성
# tags : 해당 문제의 태그를 ,로 구분하여 작성
# time : 해당 문제 풀이에 걸린 시간을 분단위 숫자로 작성
# try : 해당 문제에 몇번의 시도를 했는지 숫자로 작성
# help: 해당 문제에 외부의 도움을 받았는지 true/false로 작성
# url : 해당 문제의 url을 작성
id: 181879
categories: [list]
tags: []
time: 5
try: 1
help: false
url: https://school.programmers.co.kr/learn/courses/30/lessons/181879?language=cpp
  • Loading branch information
gogumaC committed Sep 1, 2024
1 parent 067b546 commit a1a4468
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <string>
#include <vector>

using namespace std;

int solution(vector<int> num_list) {
int answer = 0;

if(num_list.size()<=10){
answer=1;
for(int i=0;i<num_list.size();i++){
answer*=num_list[i];
}
}else{
for(int i=0;i<num_list.size();i++){
answer+=num_list[i];
}
}
return answer;
}

0 comments on commit a1a4468

Please sign in to comment.