프로그래머스 131705 삼총사

Jmnote (토론 | 기여)님의 2023년 12월 6일 (수) 20:05 판 (새 문서: ==개요== {{프로그래머스|레벨=1|페이지=2|분류=연습문제}} ==C++== <syntaxhighlight lang='cpp'> #include <string> #include <vector> using namespace std; int solutio...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요[ | ]

프로그래머스 131705 삼총사

2 C++[ | ]

#include <string>
#include <vector>

using namespace std;

int solution(vector<int> number) {
    int answer = 0;
    for(int i=0; i<number.size(); i++) {
        for(int j=i+1; j<number.size(); j++) {
            for(int k=j+1; k<number.size(); k++) {
                if(number[i]+number[j]+number[k] == 0) answer++;
            }
        }
    }
    return answer;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}