내적

NJW·2021년 8월 29일
0

코테

목록 보기
83/170

들어가는 말

a에다가 b를 곱해서 전부 더해주는 값을 출력해준다.

코드 설명

for문을 돌리면서 조건대로 수식을 만들어서 출력하면 된다.

코드

#include <string>
#include <vector>

using namespace std;

int solution(vector<int> a, vector<int> b) {
    int answer = 0;
    
    for(int i=0; i<a.size(); i++){
        answer = answer + (a[i] * b[i]);
    }
    return answer;
}
profile
https://jiwonna52.tistory.com/

0개의 댓글