This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import sys | |
| def solve(h,n): | |
| if n == 0: | |
| return h | |
| dp = [0] * (n+1) | |
| dp[0] = h | |
| for i in range(1,n+1): | |
| a,b,c = 0,0,0 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import time | |
| F = [0]*50 | |
| def fibo(n): | |
| if n == 1 or n == 2: | |
| return 1 | |
| return fibo(n-1) + fibo(n-2) | |
| def fibo_memoization(n): | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | from collections import deque | |
| a = deque() | |
| a.append(1) | |
| a.append(2) | |
| a.append(3) | |
| print(a.popleft()) | |
| >>> 1 | |
| print(a.popleft()) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | int Queue[1000] = {0,}; | |
| int wp = 0, rp = 0; //write point와 read point | |
| void enqueue(int x) {Queue[wp++] = x;} | |
| // queue를 사용할 때 가장 앞 요소를 조회만 하는 경우가 많음 | |
| //// 조회만 하는 front와 queue에서 요소를 제거하는 dequeue로 나누어 구현 | |
| int front(void) {return Queue[rp++];} | |
| void dequeue(void) {rp++;} | |
| int isEmpty(void) {return rp==wp;} | |
| int isFull(void) {return wp == 999;} | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | int Stack[1000] = {0,}; | |
| int wp = -1; // write point이면서 동시에 read point | |
| int isEmpty(void) {return wp == -1;} | |
| int isFull(void) {return wp == 999;} | |
| void push(int x) {Stack[++wp] = x;} | |
| // Stack을 사용할 때 가장 위의 자료의 값만 확인하는 경우가 많음 | |
| //// pop() 기능을 가장 위의 자료를 조회하는 top기능과 실제로 stack에서 제거하는 pop으로 나누어 구현 | |
| int top(void){return Stack[wp];} | |
| void pop(void){wp--;} | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import sys | |
| class dice: | |
| def __init__(self): | |
| self.up = 1 | |
| self.down = 6 | |
| self.west = 4 | |
| self.east = 3 | |
| self.north = 2 | |
| self.south = 5 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class Book: | |
| # class variable | |
| order = 0 | |
| # static method | |
| @staticmethod | |
| def decorate_name(name): | |
| return f'*{name}*' | |
| # class method | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class Book: | |
| def __init__(self, title): | |
| self.title = title | |
| b1 = Book("book_name_1") | |
| b2 = Book("book_name_2") | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import sys | |
| def check_row(row:list): | |
| global L, N | |
| RAMP = [0]*N | |
| before = row[0] | |
| for i in range(1, N): | |
| cur = row[i] | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import sys | |
| # 방향은 우 상 좌 하 순서 | |
| table = [[0]*101 for i in range(101)] | |
| def path_list(d,g): | |
| path= [d] | |
| for gen in range(g): | |
| for i in range(len(path)-1, -1, -1): | |
| path.append((path[i] + 1)%4) ## 돌아가는 순서 잘못됨 | |
| return path |