일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 이진탐색 #나무 자르기
- ㅂ
- 오픽노잼
- English
- 오픽가격
- 탑다운
- 영어회화
- 안드로이드주석
- stack 스택
- 오픽노잼공부방법
- 디피
- 메모이제이션
- 오픽점수잘받는방법
- dynamicProgramming
- 피보나치수열
- dp
- 오픽
- XML주석
- XML
- 다이나믹프로그래밍
- 주석
- 오픽공부법
- topdown
- fibo
- 바텀업
- 안드로이드
- opic
- 영어말하기
- 이진탐색
목록PS/BOJ (143)
RUBY
출처:: https://www.acmicpc.net/problem/1157 분류::문자열 1. 문제 이해 및 해결과정 2. 풀이방법 1) 아스키코드 이용, chr() alpha = [ 0 for i in range(26)] a = input() for i in a : alpha[ord(i.lower()) - 97] +=1 max = -1 maxindex = -1 maxcnt= 0 for i in range(26): if alpha[i] > max: max = alpha[i] maxindex = i for i in range(26): if alpha[i] == max: maxcnt += 1 if maxcnt > 1 : print("?") else : print(chr(maxindex+97).upper())..
출처:: https://www.acmicpc.net/problem/2744 분류::문자열 1. 문제 이해 및 해결과정 2. 풀이방법 1)python s = input() ans = "" for ch in s: if ch.isupper(): #대문자라면, 소문자로 ans += ch.lower() else : #소문자라면, 대문자로 ans += ch.upper() #ans += ch.lower() if ch.isupper() else ch.upper() print(ans) 2) python print(input().swapcase()) 3. 오답원인 4. 알게된 점 1) islower() : 소문자인지여부 2) upper() : 대문자로 변경 3) swapcase() : 대소문자 변경
출처:: https://www.acmicpc.net/problem/18405 분류:: bfs 1. 문제 이해 및 해결과정 - 바이러스가 낮은 번호부터 증식한다 ->큐에 낮은 바이러스 번호부터 넣어야한다. 2. 풀이방법 1. [ python ] bfs #경쟁적 전염 #https://www.acmicpc.net/problem/18405 import sys from collections import deque sys.stdin = open("input.txt","r") input=sys.stdin.readline n,k=map(int,input().split()) board=[list(map(int,input().split())) for i in range(n)] virus=[] #바이러스에 대한 정보 dh=..
출처:: https://www.acmicpc.net/problem/11866 분류:: 큐 1. 문제 이해 및 해결과정 2. 풀이방법 1. [ python ] 큐 #요세푸스 문제 0 #https://www.acmicpc.net/problem/11866 import sys from collections import deque sys.stdin = open("input.txt","r") n,k=map(int,input().split()) q=deque(i for i in range(1,n+1)) res=[] while q: q.rotate(-(k-1)) res.append(q.popleft()) i=1 cnt=0 print("" %res[i]) else: print("%d, " %res[i],end='') 3..
출처:: https://www.acmicpc.net/problem/2164 분류:: 큐 1. 문제 이해 및 해결과정 2. 풀이방법 1. [ python ] 큐 #카드2 #https://www.acmicpc.net/problem/2164 import sys from collections import deque sys.stdin = open("input.txt","r") n=int(input()) q=deque() for i in range(1,n+1): q.append(i) while len(q)>1: q.popleft() card=q.popleft() q.append(card) print(q.pop()) 3. 오답원인 4. 알게된 점

출처:: https://www.acmicpc.net/problem/1068 분류:: dfs, 트리 1. 문제 이해 및 해결과정 2. 풀이방법 1. [ python ] 딕셔너리 이용 #트리 #https://www.acmicpc.net/problem/1068 import sys from collections import deque sys.stdin = open("input.txt","r") n=int(input()) #노드의 개수 tree={} parents=list(map(int,input().split())) #각 노드의 부모노드가 주어진다 d=int(input()) #삭제할 노드 for i in range(n): #트리의 형태 만들어 줌 tree[i]=[] #{0: [], 1: [], 2: [], 3:..
출처:: www.acmicpc.net/problem/15661 분류:: 브루트 포스 1. 문제 이해 및 해결과정 - 딱 같은 수 만큼 링크팀과 스타트팀이 선택하는 것이 아니라, 최소1개 ~ N-1개까지 각각 팀선택이 가능하다 -> 어떻게 구현하지? dfs -> 선택하거나 안하거나 모든 경우의 수를 구하자 2. 풀이방법 1. [ python ] dfs #링크와 스타트 #https://www.acmicpc.net/problem/15661 import sys sys.setrecursionlimit(10**6) sys.stdin = open("input.txt","r") n=int(input()) board=[list(map(int,input().split())) for _ in range(n)] team = ..

출처:: https://www.acmicpc.net/problem/11725 분류:: bfs 1. 문제 이해 및 해결과정 - 가장 가까운 노드 찾으면 된다 2. 풀이방법 1. [ python ] bfs #트리의 부모 찾기 #https://www.acmicpc.net/problem/11725 import sys from collections import deque sys.stdin = open("input.txt","r") n=int(input()) tree=[[] for _ in range(n+1)] visited=[False for _ in range(n+1)] res=[0]*(n+1) for i in range(n-1): a,b=map(int,input().split()) tree[a].append(..