[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ๋ด์ / Python
๐ Problem Solving/Programmers
์ฝ๋ฉํ ์คํธ ์ฐ์ต - ๋ด์
๊ธธ์ด๊ฐ ๊ฐ์ ๋ 1์ฐจ์ ์ ์ ๋ฐฐ์ด a, b๊ฐ ๋งค๊ฐ๋ณ์๋ก ์ฃผ์ด์ง๋๋ค. a์ b์ ๋ด์ ์ return ํ๋๋ก solution ํจ์๋ฅผ ์์ฑํด์ฃผ์ธ์. ์ด๋, a์ b์ ๋ด์ ์ a[0]*b[0] + a[1]*b[1] + ... + a[n-1]*b[n-1] ์ ๋๋ค. (n์ a, b์
programmers.co.kr
import sys
input = sys.stdin.readline
a = list(map(int, input().split()))
b = list(map(int, input().split()))
def solution(a, b):
answer = 0
for i in range(len(a)):
answer += a[i] * b[i]
return answer
print(solution(a, b))
ํด์ค
๊ฐ๋จํ ์ฐ์ฐ๋ฌธ์
'๐ Problem Solving > Programmers' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ์์ ๋ง๋ค๊ธฐ / Python (0) | 2021.06.01 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ํฐ์ผ๋ชฌ / Python (0) | 2021.06.01 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ํฌ๋ ์ธ ์ธํ๋ฝ๊ธฐ / Python (0) | 2021.06.01 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] K๋ฒ์งธ์ / Python (0) | 2021.06.01 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ๋ชจ์๊ณ ์ฌ / Python (0) | 2021.06.01 |