백준알고리즘 1008번 A/B

2024. 11. 25. 12:31Algorithms/백준알고리즘 연습

 

A, B = (input(), split())
print(a/b)

a, b = map(int, input().split())
print(a/b)

 

처음만든코드와 나중에 만든 정답 코드

what's the key difference? 

 

 

  • map(int, input().split()):
    • Processes the input into two integers and unpacks them.
    • map(int, ...) converts each string in the list to an integer (e.g., [10, 20]).
    • The two integers are unpacked into variables A and B.
  • (input(), split()):
    • Is invalid because split() is not called on a string, and unpacking into A, B doesn’t make sense here.