일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 파이썬
- bootstrap
- 알고리즘
- ubuntu
- NAV
- springboot3.x
- 16.04
- MongoDB
- CSS
- 2579
- 크롤링
- 2909
- 백준
- 라즈베리파이
- dp
- nav-tab
- algotythm
- HTML
- 트리
- dynaminprogramming
- Python
- raspberrypi
- 라즈베리파이3
- 라즈베리파이3b+
- node.js
- 라즈비안
- Crawling
- Algorythm
- baekjun
- 13237
Archives
- Today
- Total
목록12789 (1)
노트
[백준] 12789번 도키도키 간식드리미 python
n = int(input()) line = list(map(int,input().split())) passed = [] stack = [] number = 1 while line: temp = line.pop(0) if temp==number: passed.append(temp) number+=1 else: stack.insert(0,temp) while stack: num = stack.pop(0) if len(stack)+1>=0 and num==number: passed.append(num) number+=1 else: stack.insert(0,num) break if not stack: print("Nice") else: print("Sad")
알고리즘
2023. 5. 25. 22:13