전체 글 68

[백준]10844 쉬운 계단 파이썬 python

문제링크 https://www.acmicpc.net/problem/10844 10844번: 쉬운 계단 수 첫째 줄에 정답을 1,000,000,000으로 나눈 나머지를 출력한다. www.acmicpc.net 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 import sys input = sys.stdin.readline n = int(input()) d = [[0]*10 for _ in range(101)] d[1] = [0,1,1,1,1,1,1,1,1,1] for i in range(2,n+1): for j in range(0,10): if j ==0: d[i][j] = d[i-1][j+1] elif j==9: d[i][j] = d[i-1][j-1] else: d[i][..

Algorithm/Baekjoon 2022.02.08

[백준]15990 1, 2, 3더하기 5 파이썬 python

문제링크 https://www.acmicpc.net/problem/15990 15990번: 1, 2, 3 더하기 5 각 테스트 케이스마다, n을 1, 2, 3의 합으로 나타내는 방법의 수를 1,000,000,009로 나눈 나머지를 출력한다. www.acmicpc.net 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 import sys input = sys.stdin.readline mod=1000000009 MAX = 100001 d = [[0]*4 for _ in range(MAX)] d[1]=[0,1,0,0] d[2]=[0,0,1,0] d[3]=[0,1,1,1] for i in range(4,MAX): d[i][1] = (d[i-1][2]+d[i-1][3])%mod ..

Algorithm/Baekjoon 2022.02.07

[백준]11052 카드구매하기 16194 카드구매하기2 파이썬 python

문제링크 https://www.acmicpc.net/problem/11052 11052번: 카드 구매하기 첫째 줄에 민규가 구매하려고 하는 카드의 개수 N이 주어진다. (1 ≤ N ≤ 1,000) 둘째 줄에는 Pi가 P1부터 PN까지 순서대로 주어진다. (1 ≤ Pi ≤ 10,000) www.acmicpc.net https://www.acmicpc.net/problem/16194 16194번: 카드 구매하기 2 첫째 줄에 민규가 구매하려고 하는 카드의 개수 N이 주어진다. (1 ≤ N ≤ 1,000) 둘째 줄에는 Pi가 P1부터 PN까지 순서대로 주어진다. (1 ≤ Pi ≤ 10,000) www.acmicpc.net 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 import sys impor..

Algorithm/Baekjoon 2022.02.06

[Tutorial] TraCI4Traffic Lights

0. 튜토리얼 링크 https://sumo.dlr.de/docs/Tutorials/TraCI4Traffic_Lights.html TraCI4Traffic Lights - SUMO Documentation 1.1.0 --> TraCI4Traffic Lights This shows how to use the Traffic Control Interface (in short TraCI) on a simple example. TraCI gives the possibility to control a running road traffic simulation. TraCI uses a TCP-based client/server architecture where SUMO sumo.dlr.de 다음 튜토리얼의 목표는 북에서..

[백준]9095 1, 2, 3 더하기 파이썬 python

문제링크 https://www.acmicpc.net/problem/9095 9095번: 1, 2, 3 더하기 각 테스트 케이스마다, n을 1, 2, 3의 합으로 나타내는 방법의 수를 출력한다. www.acmicpc.net 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 import sys input = sys.stdin.readline t = int(input()) for i in range(t): n = int(input()) d = [0]*12 d[1] = 1 d[2] = 2 d[3] = 4 if n>3: for i in range(4,n+1): d[i] = d[i-1]+d[i-2]+d[i-3] print(d[n]) Colored by Color Scripter cs Point - 다..

Algorithm/Baekjoon 2022.02.05

[Tutorial] Hello SUMO

목차 0. 튜토리얼 소개 1. Network 구성 방법 2. Route 구성 방법 3. GUI 세팅 4. Configuation 작성 5. Run Simulation 0. 튜토리얼 소개 https://sumo.dlr.de/docs/Tutorials/Hello_SUMO.html#routes Hello SUMO - SUMO Documentation 1.1.0 --> Hello SUMO Introduction This tutorial aims at first time Sumo users. We are building the simplest net possible and let a single car drive on it. All files mentioned here can also be found in the..

[백준]11727 2*n타일링2 파이썬 python

문제링크 https://www.acmicpc.net/problem/11727 11727번: 2×n 타일링 2 2×n 직사각형을 1×2, 2×1과 2×2 타일로 채우는 방법의 수를 구하는 프로그램을 작성하시오. 아래 그림은 2×17 직사각형을 채운 한가지 예이다. www.acmicpc.net 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 import sys input = sys.stdin.readline n = int(input()) d = [0]*1001 d[1]=1 d[2]=3 for i in range(3, n+1): d[i] = (d[i-1] + 2*d[i-2])%10007 print(d[n]) cs Point - 다이나믹프로그래밍으로 접근 Subproblem 만족 & Optimal S..

Algorithm/Baekjoon 2022.02.04

[백준]11726 2*n 타일링 파이썬 python

문제링크 https://www.acmicpc.net/problem/11726 11726번: 2×n 타일링 2×n 크기의 직사각형을 1×2, 2×1 타일로 채우는 방법의 수를 구하는 프로그램을 작성하시오. 아래 그림은 2×5 크기의 직사각형을 채운 한 가지 방법의 예이다. www.acmicpc.net 코드 1 2 3 4 5 6 7 8 9 10 11 import sys input = sys.stdin.readline n = int(input()) d = [0]*1001 d[1] = 1 d[2] = 2 for i in range(3, n+1): d[i] = d[i-1] + d[i-2] print(d[n]%100007) cs Point - 다이나믹프로그래밍으로 접근 Overlapping Subproblem & ..

Algorithm/Baekjoon 2022.01.16

[백준]1463 1로 만들기 파이썬 python

문제링크 https://www.acmicpc.net/problem/1463 1463번: 1로 만들기 첫째 줄에 1보다 크거나 같고, 106보다 작거나 같은 정수 N이 주어진다. www.acmicpc.net 코드 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 32 import sys from collections import deque #DP접근 n= int(input()) d = [0]*(n+1) d[1] = 0 #초항 명시 for i in range(2,n+1): d[i] = d[i-1]+1 if i%2==0 and d[i]>d[i//2]+1: d[i] = d[i//2]+1 if i%3==0 and ..

Algorithm/Baekjoon 2022.01.15

[백준]1261 알고스팟 파이썬 python

문제링크 https://www.acmicpc.net/problem/1261 1261번: 알고스팟 첫째 줄에 미로의 크기를 나타내는 가로 크기 M, 세로 크기 N (1 ≤ N, M ≤ 100)이 주어진다. 다음 N개의 줄에는 미로의 상태를 나타내는 숫자 0과 1이 주어진다. 0은 빈 방을 의미하고, 1은 벽을 의미 www.acmicpc.net 코드 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 32 33 import sys from collections import deque input = sys.stdin.readline #입력 m,n = map(int, input().split()) map = [ l..

Algorithm/Baekjoon 2022.01.15