Algorithm
백준
Python
백준 사용법

백준 사용법

백준 사용법

데이터 입력받기

한 줄에 여러 개의 데이터가 들어오는 경우

data = list(map(int, input().split()))

한 줄에 들어오는 데이터가 많지 않은 경우

a, b, c = map(int, input().split())

그래프 문제 데이터 입력 받기

n, m = map(int, input().split())
graph = []
for i in  range(n):
    graph.append(list(input()))

그래프 길이가 주어지지 않는 경우

참고 Link (opens in a new tab)

sys.stdin 활용

import sys
 
for line in sys.stdin : 
  a, b = map(int, line.split())
  print(a + b)

Try Except 활용

while True : 
  try : 
    a, b = map(int, input().split())
  except : 
    break