행렬의 덧셈
https://school.programmers.co.kr/learn/courses/30/lessons/12950
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
#include <string>
#include <vector>
using namespace std;
vector<vector<int>> solution(vector<vector<int>> arr1, vector<vector<int>> arr2)
{
vector<vector<int>> answer;
answer.reserve(arr1.size());
for(int i = 0; i < arr1.size(); ++i)
{
vector<int> tempArr;
tempArr.reserve(arr1[i].size());
for(int j = 0; j < arr1[i].size(); ++j)
{
tempArr.push_back(arr1[i][j] + arr2[i][j]);
}
answer.push_back(tempArr);
}
return answer;
}
하샤드 수
https://school.programmers.co.kr/learn/courses/30/lessons/12947
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
#include <string>
#include <vector>
using namespace std;
bool solution(int x)
{
string strText = to_string(x);
int iNum(0);
for(int i = 0; i < strText.size(); ++i)
{
iNum += strText[i] - 48;
}
if(x % iNum == 0)
{
return true;
}
return false;
}
'프로그래밍 > 코딩테스트' 카테고리의 다른 글
[백준] 3052 나머지 (0) | 2023.07.05 |
---|---|
[프로그래머스] 같은 숫자는 싫어 (0) | 2023.06.22 |
[프로그래머스] 1레벨 (0) | 2023.06.20 |
[프로그래머스] 1레벨 여러문제 (0) | 2023.06.17 |
[프로그래머스] 1레벨 여러문제 (0) | 2023.06.11 |
댓글