시나위

  • 홈
  • 태그
  • 방명록

스택수열 1

[백준] 1874 스택수열 python

www.acmicpc.net/problem/1874 1874번: 스택 수열 1부터 n까지에 수에 대해 차례로 [push, push, push, push, pop, pop, push, push, pop, push, push, pop, pop, pop, pop, pop] 연산을 수행하면 수열 [4, 3, 6, 8, 7, 5, 2, 1]을 얻을 수 있다. www.acmicpc.net n = int(input()) numbers = [int(input()) for _ in range(n)] stack = [] result_list = [] num = 1 result = 0 while num n: if stack[-1] == numbers[result]: result += 1 stack.pop() result_l..

STUDY/Algorithm 2021.04.28
이전
1
다음
더보기
프로필사진

하고 싶은 거 다하고 정리하는 블로그

  • 분류 전체보기 (669)
    • STUDY (529)
      • Algorithm (402)
      • C, C++ (7)
      • Python (33)
      • Rust (28)
      • Swift & iOS (16)
      • Web (10)
      • Raspberry Pi (10)
      • Others (23)
    • OTHERS (140)
      • 내 생각 (134)
      • 리뷰 (5)

Tag

BOJ, BFS, 파이썬, C, 브루트포스, dfs, 혼공파, python3, 다익스트라, C++, 백준, 백트래킹, 구현, 혼공단, 시뮬레이션, baekjoon, dp, python, 그래프탐색, 프로그래머스,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2025/05   »
일 월 화 수 목 금 토
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

방문자수Total

  • Today :
  • Yesterday :

Copyright © Kakao Corp. All rights reserved.

티스토리툴바