일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
- 타입스크립트
- java
- MySQL
- 자바
- 자바 for문
- 자바 조건문
- react ag grid
- 자바 자동캐스팅
- 자바 향상된 for문
- 자바 공배수
- 자바 if문
- 자바 스캐너
- 자바 public
- Vue3
- 자바 구구단 출력
- Til
- 자바 강제 캐스팅
- 항해99 2기
- 자바 반복문
- 자바 switch문
- 자바 while문
- TypeScript
- 정보처리기사실기
- 프로그래머스
- 변수
- 항해99
- react with typescript
- 이클립스 DB연동
- 조코딩
- 자바 삼항연산자
- Today
- Total
목록알고리즘 (78)
뇌 채우기 공간

코드 num = int(input()) #원소가 몇 개 있는지 original_list = [] # 원래 주어지는 배열 for i in range(num): a = int(input()) #리스트의 원소들 original_list.append(a) # print(original_list) ordered_list = sorted(original_list) #오름차순 정렬한 배열 stack = [] origin_index = 0 #원래 배열과 비교하기 위한 변수 push_pop=[] #연산을 저장하는 배열 for index in range(len(ordered_list)): stack.append(ordered_list[index]) push_pop.append('+') for i in range(len(s..

코드 while True: string = input() if string == '.': break stack = [] check = True for i in string: if i == '(' or i == '[': #stack에 넣음 stack.append(i) elif i == ')': if stack and stack[-1] == '(': #stack이 안비었으면 stack.pop() else: check = False break elif i == ']': if stack and stack[-1] == '[': #stack이 안비었으면 stack.pop() else: check = False break if not stack and check: print('yes') else: print('no'..

코드 def factorial(n): num = 1 for i in range(1, n+1): num *=i return num test_case = int(input()) for i in range(test_case): n,m = map(int, input().split()) bridge = factorial(m)/( factorial(n)* factorial(m-n)) print(int(bridge)) 풀이 조합으로 풀면 됨 2021.06.21 - [알고리즘/백준 문제풀이] - [백준] 11050 이항계수 1 파이썬 풀이 (정수론 및 조합론) [백준] 11050 이항계수 1 파이썬 풀이 (정수론 및 조합론) 코드 import math N,K = map(int, input().split()) resul..

코드 import math N,K = map(int, input().split()) result = 1 for i in range(K): result *= N/K N = N-1 K = K-1 print(round(result)) 풀이 이항계수란 조합론에서 등장하는 개념으로 주어진 크기 집합에서 원하는 개수만큼 순서없이 뽑는 조합의 가짓수를 일컫는다 round -> 반올림

코드 num = int(input()) for i in range(num): a,b = map(int,input().split()) A,B = a,b while a!=0: b = b%a a,b = b,a # print(a,b) gcd = b lcm = A * B //b print(lcm) 풀이 2021.06.20 - [알고리즘/백준 문제풀이] - [백준] 2609 최대 공약수와 최소 공배수 파이썬 풀이 [백준] 2609 최대 공약수와 최소 공배수 파이썬 풀이 코드 A,B = map(int, input().split()) # 최대 공약수는 # 둘중에 작은 수와 큰수%작은수와의 최대공약수와 같다 # 작은 수가 0이 될때까지 반복한다. 그럼 큰 수가 최대 공약수이다. a,b = A,B while b!=0: a..