카테고리 없음

input 받는 법 여러가지

코테챌린져 2024. 1. 19. 14:54

1. 변수 따로 받기

x,y = input().split(' ')

x,y = map(int,input().split(' '))

 

2. 리스트로 받기

x = input.split(' ')   #x = list(input.split(' ')) 할 필요 없음

x = list(map(int,input().split(' ')))

 

3. input 더 빨리 받는 방법 

input() 대신 sys.stdin.readline().rstrip()

x = list(map(int,(sys.stdin.readline().rstrip().split(' '))))