알고리즘 테스트/Hackerrank 문제풀이 및 해설
<Hackerrank 문제풀이: 파이썬> Inner and Outer
개발린이
2020. 11. 12. 20:26
numpy를 이용한 간단한 문제이다:
import numpy
import sys
A = list(map(int, sys.stdin.readline().split()))
B = list(map(int, sys.stdin.readline().split()))
C = numpy.array(A)
D = numpy.array(B)
print(numpy.inner(C, D))
print(numpy.outer(C, D))
A, B를 list(map())을 이용하여 리스트로 두개의 숫자를 입력해준 후, 각각의 리스트를 C, D에 부여를 한다. 마지막으로 numpy.inner과 numpy.outer을 출력한다.