[Python] Random Library
※ Random 난수를 생성하는 라이브러리 ■ 라이브러리 호출 > import random ■ random □ .random() 0과 1사이의 실수인 난수 출력 # e.g. > random.random() # 0.61997310596089...
※ Random 난수를 생성하는 라이브러리 ■ 라이브러리 호출 > import random ■ random □ .random() 0과 1사이의 실수인 난수 출력 # e.g. > random.random() # 0.61997310596089...
※ Math 수학 계산과 관련된 라이브러리 ■ 라이브러리 호출 > import math ■ math □ .gcd 최대 공약수 (greatest common divisor) 출력 # e.g. > math.gcd(60, 100, 80) # 2...
※ Itertools 순열, 조합 등의 계산이 가능한 라이브러리 ■ 라이브러리 호출 > import itertools ■ itertools □ .zip_longest() zip 함수와 동일하나, 길이가 다른 경우에도 사용이 가능 길이가 다른 경...
※ Datetime 날짜를 계산하기 위한 라이브러리 ■ 라이브러리 호출 > import datetime ■ datetime.date □ .days 일수 계산 # e.g. > day1 = datetime.date(2024, 1, 1) >...
모든 문제 출처: https://www.acmicpc.net # 킹, 퀸, 룩, 비숍, 나이트, 폰 # 체스는 총 16개의 피스를 사용하며, 킹 1개, 퀸 1개, 룩 2개, 비숍 2개, 나이트 2개, 폰 8개로 구성되어 있다. # 피스의 개수가 주어졌을 때, 몇 개를 더하...