-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[level 1] Title: 행렬의 덧셈, Time: 46.89 ms, Memory: 22.9 MB -BaekjoonHub
- Loading branch information
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# [level 1] 행렬의 덧셈 - 12950 | ||
|
||
[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/12950) | ||
|
||
### 성능 요약 | ||
|
||
메모리: 22.9 MB, 시간: 46.89 ms | ||
|
||
### 구분 | ||
|
||
코딩테스트 연습 > 연습문제 | ||
|
||
### 채점결과 | ||
|
||
정확성: 100.0<br/>합계: 100.0 / 100.0 | ||
|
||
### 제출 일자 | ||
|
||
2024년 06월 25일 12:55:56 | ||
|
||
### 문제 설명 | ||
|
||
<p>행렬의 덧셈은 행과 열의 크기가 같은 두 행렬의 같은 행, 같은 열의 값을 서로 더한 결과가 됩니다. 2개의 행렬 arr1과 arr2를 입력받아, 행렬 덧셈의 결과를 반환하는 함수, solution을 완성해주세요.</p> | ||
|
||
<h5>제한 조건</h5> | ||
|
||
<ul> | ||
<li>행렬 arr1, arr2의 행과 열의 길이는 500을 넘지 않습니다.</li> | ||
</ul> | ||
|
||
<h5>입출력 예</h5> | ||
<table class="table"> | ||
<thead><tr> | ||
<th>arr1</th> | ||
<th>arr2</th> | ||
<th>return</th> | ||
</tr> | ||
</thead> | ||
<tbody><tr> | ||
<td>[[1,2],[2,3]]</td> | ||
<td>[[3,4],[5,6]]</td> | ||
<td>[[4,6],[7,9]]</td> | ||
</tr> | ||
<tr> | ||
<td>[[1],[2]]</td> | ||
<td>[[3],[4]]</td> | ||
<td>[[4],[6]]</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
> 출처: 프로그래머스 코딩 테스트 연습, https://school.programmers.co.kr/learn/challenges |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
def solution(arr1, arr2): | ||
answer = [[0 for i in range(len(arr1[0]))] for i in range(len(arr1))] | ||
for i in range(len(arr1)): | ||
for j in range(len(arr1[i])): | ||
answer[i][j] += arr1[i][j]+arr2[i][j] | ||
return answer | ||
|
||
solution([[1,2],[2,3]],[[3,4],[5,6]]) |