Algorithm/알고리즘개념

알고리즘 문제 입출력 코드 및 라이브러리 정리

patrck_jjh 2021. 11. 6. 16:20

 

1. 입력 코드

# 1 
list(map(int,input().split())  # 숫자를 띄어쓰기로 구분하여 int type으로 리스트화 한다.

# 2
n = int(input())	# 변수 n에 int type의 개별 숫자 입력
data = list(map(int,input().split())	# 변수 data에 #1의 기능 입력

# 3
n, m, k = map(int, input().split()) # 띄어쓰기로 구분된 각 숫자를 변수 n, m, k에 할당함

# 4
import sys
sys.stdin.readline().rstrip()	# sys패키지의 stdin기능을 활용하여 input()보다 빠른 입력이 가능

# 5
print(a, b) 	# print 기본
print(f"str {var}")

 

 

2. 활용가능 라이브러리

# 1
from itertools import permutations
from itertools import combinations

# 2
import heapq

# 3
from bisect import bisect_left, bisect_right

# 4
from collections import deque
from collections import Counter

counter = Counter(list) # 객체 내부의 원소가 몇 번 등장했는지 알려주는 기능

# 5
import math
math.facotrial()
math.sqrt()
math.gcd(a, b)
math.pi()
math.e()