[백준 바킹독] 0x09 - BFS 토마토(7576)
Introduction
무차별 대입 공격
from itertools import product
list = product(A, repeeat=B)
A는 조합을 만들 내용 입력, B는 자릿수 입력
from itertools import product
iterator1 = [1, 2, 3]
iterator2 = ['A', 'B', 'C']
print(list(product(iterator1, iterator2)))
>>> [(1, 'A'), (1, 'B'), (1, 'C'), (2, 'A'), (2, 'B'), (2, 'C'), (3, 'A'), (3, 'B'), (3, 'C')]
print([(i,j) for i in iterator1 for j in iterator2])
>>> [(1, 'A'), (1, 'B'), (1, 'C'), (2, 'A'), (2, 'B'), (2, 'C'), (3, 'A'), (3, 'B'), (3, 'C')]
from itertools import product
iterator = ['A','B','C','D','E']
print(list(product(iterator, repeat = 1)))
>>> [('A',), ('B',), ('C',), ('D',), ('E',)]
print(list(product(iterator, repeat = 2)))
>>> [('A', 'A'), ('A', 'B'), ('A', 'C'), ('A', 'D'), ('A', 'E'), ('B', 'A'), ('B', 'B'), ('B', 'C'), ('B', 'D'), ('B', 'E'), ('C', 'A'), ('C', 'B'), ('C', 'C'), ('C', 'D'), ('C', 'E'), ('D', 'A'), ('D', 'B'), ('D', 'C'), ('D', 'D'), ('D', 'E'), ('E', 'A'), ('E', 'B'), ('E', 'C'), ('E', 'D'), ('E', 'E')]
from itertools import permutations
iterator = ['A','B','C']
print(list(permutations(iterator)))
>>> [('A', 'B', 'C'), ('A', 'C', 'B'), ('B', 'A', 'C'), ('B', 'C', 'A'), ('C', 'A', 'B'), ('C', 'B', 'A')]
print(list(permutations(iterator, 2)))
>>> [('A', 'B'), ('A', 'C'), ('B', 'A'), ('B', 'C'), ('C', 'A'), ('C', 'B')]
from itertools import combinations
iterator = ['A','B','C']
print(list(combinations(iterator, len(iterator))))
>>> [('A', 'B', 'C')]
print(list(combinations(iterator, 2)))
>>> [('A', 'B'), ('A', 'C'), ('B', 'C')]
import time
from itertools import product
password = "world1"
number = "0123456789"
lowercase = "abcdefghijklmnopqrstuvwxyz"
uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
symbol = "!@#$%^&*()_+-=`~"
possibility = lowercase + number
attempt = product(possibility, repeat=len(password))
start = time.time()
def run():
for i in attempt:
if "".join(i) == password:
print("비밀번호 : " + str("".join(i)))
print("소요시간 : " + str(time.time() - start))
run()
반복적인 패턴 찾아내기 -> 점화식 찾기
def combination(arr,r):
wanted=[]
if r==1:
for i in arr:
wanted.append([i])
else:
for i in range(len(arr)-r+1):
for j in combination(arr[i+1:], r-1):
wanted.append([arr[i]]+j)
return wanted
https://www.acmicpc.net/step/22
from itertools import combinations
N, M = map(int, input().split(' '))
cards = list(map(int, input().split(' ')))
output = 0
for card in combinations(cards, 3):
val = card[0]+card[1]+card[2]
if M >= val and output < val:
output = val
print(output)
num = int(input())
output = 0
for n in range(num):
sum = 0
for i in str(n):
sum += int(i)
if n+sum == num:
output=n
break
print(output)
N = int(input())
people = []
for i in range(N):
people.append(list(map(int,input().split(' '))))
output = []
for p in people:
k=1
for other in people:
if p[0]<other[0] and p[1]<other[1]:
k+=1
output.append(k)
result = ''
for i in output:
result = result + str(i) + ' '
print(result[:-1])
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
1167 트리의 지름
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Git 명령어를 사용한 하위 디렉토리 다운로드 Clone 할 로컬 저장소 생성
Introduction
# Fetch the submodule commits into the main repository git remote add submodule_origin git://url/to/submodule/origin git fetch submodule_origin
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Graph
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Spring Project
the page for java
가벼운 Base image를 사용
version: 3.0.0a10
WIDTH
version: 3.0.0a10
#include <iostream> #include <thread> #include <chrono> #include <mutex> #include <atomic> #include <string.h>
version: 3.0.0a10
https://cplusplus.com/reference/future/
Multithreading support was introduced in C++11.
how to costom github blog using jekyll
You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different wa...