전체 글 211

[Python][SWEA] 4615. 재미있는 오셀로 게임 D3

SW Expert AcademySW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!swexpertacademy.com🗒️파이썬 코드 풀이T = int(input())for tc in range(1,T+1) : N,M = map(int,input().split()) lst = [list(map(int,input().split())) for _ in range(M)] # 오셀로 기본 세팅 othello = [[0] * (N+1) for _ in range(N+1)] center = N//2 othello[center][center] = othello[center+1][center+1] = 2 othello[center+1][center] = oth..

알고리즘/swea 2024.05.05

[Python][SWEA] S/W 문제해결 기본 3일차 - 회문2 D3

SW Expert AcademySW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!swexpertacademy.com🗒️파이썬 코드 풀이for tc in range(1,11) : T = int(input()) lst = [] lst = [list(input()) for _ in range(100)] lst_v = [] # 세로->가로 전환 리스트 for j in range(100): tmp = [] for i in range(100): tmp.append(lst[i][j]) lst_v.append(tmp) mx = 1 for i in range(100) : # 1~100개 ..

알고리즘/swea 2024.05.05

[Python][SWEA] 1860. 진기의 최고급 붕어빵 D3

SW Expert AcademySW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!swexpertacademy.com 🗒️파이썬 코드 풀이T = int(input())for tc in range(1,T+1) : N,M,K = map(int,input().split()) lst = list(map(int,input().split())) ans = "Possible" lst.sort() cnt = 0 for t in lst : cnt += 1 if (t//M)*K  1. 기본값은 Possible로 한다 2. 크기순으로 sort 정렬을 해준다. (먼저 오는 손님에게 붕어빵 먼저 제공) 3. 손님들의 도착시간 리스트..

알고리즘/swea 2024.05.05

[Python][SWEA] 1249. [S/W 문제해결 응용] 4일차 - 보급로 D4

SW Expert AcademySW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!swexpertacademy.com🗝️ DFS / BFS 와 STACK / QUEUE1. DFS- 스택,재귀 함수를 이용해서 구현 (일반적으로 재귀함수 사용)- 노드를 인접 노드가 없을때까지 스택에 넣음- 방문 처리가 완료되면 스택에서 최상단 노드를 꺼냄  1. BFS- 그래프에 가까운 노드부터 우선 탐색- 큐(Queue) 자료구조 사용  🗒️파이썬 코드 풀이from collections import dequeT = int(input())for tc in range(1,T+1): N = int(input()) lst = [] lst = [list(map(int,input())) fo..

알고리즘/swea 2024.05.05

[Python][SWEA] 2814. 최장 경로 D3

SW Expert AcademySW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!swexpertacademy.com 🗒️파이썬 코드 풀이T = int(input())for tc in range(1,T+1) : N,M = map(int,input().split()) # 정점 개수, 간선 정보 ans = 0 adjL = [[] * m for m in range(N+1)] # 정점별 연결 되어있는 것 체크 리스트 for m in range(M): # s,e 변수들끼리 서로 연결 s,e = map(int,input().split()) adjL[s].append(e) adjL[e].append(s) def df..

알고리즘/swea 2024.05.04

[Python][SWEA] 2817. 부분 수열의 합 D3

SW Expert AcademySW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!swexpertacademy.com 🗒️파이썬 코드 풀이T = int(input())for tc in range(1,T+1) : N,K = map(int,input().split()) lst = list(map(int,input().split())) ans,sum,n = 0,0,0 def dfs(n,sum) : global ans if sum == K : # 총 합이 K 일때 ans += 1 return if n >= N: # n이 배열 크기만큼 도달 할 경우 return ..

알고리즘/swea 2024.05.04

[Python][SWEA] 959. 두 개의 숫자열 D2

SW Expert AcademySW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!swexpertacademy.com 🗒️파이썬 코드 풀이T = int(input())for tc in range(1,T+1): N,M = map(int,input().split()) # M,N 각각 입력 N_lst = list(map(int,input().split())) # N 리스트 입력 M_lst = list(map(int,input().split())) # M 리스트 입력 result = [] diff_len = abs(N-M) # M과 N 배열의 길이 차이 if N >= M: # N과 M 중 작은 배열의 크기를 큰 배열 크기만큼 0로 채워주기 ..

알고리즘/swea 2024.05.04

[Python][SWEA] 3752. 가능한 시험 점수 D4

SW Expert AcademySW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!swexpertacademy.com🗒️파이썬 코드 풀이T = int(input())for tc in range(1,T+1): N = int(input()) lst = list(map(int,input().split())) # 입력값 result = [0] # 결과값 저장 visit = [1] + [0] * sum(lst) # 방문 체크 for i in range(len(lst)) : for j in range(len(result)): if visit[lst[i]+result[j]] == 0 : # 방문은 안했을 경우 ..

알고리즘/swea 2024.05.04

[Python] Flask 블로그 만들기

✏️ 이전 내용 [Python] Flask 로그인/회원가입 기능 만들기✏️ 이전 내용 [Python] Firebase 시작하기 🙄 Firebase란 ? 구글이 소유하고 있는 모발일 애플리케이션 개발 플랫폼으로, 개발자가 모바일 및 웹 애플리케이션을 모두 쉽게 생성,실행 및 확장 할 수fishking.tistory.com지난 포스팅에서는 flask 서버를 통해 로그인과 회원가입을 하는 코드에 대해 소개를 했다.이번에는 추가적으로  유저가 포스팅을 하고, 포스팅 리스트들을 보는 코드를 작성한다.(이 글은  Firebase와 Flask 로그인/회원가입 포스터를 봤다는 전제로 작성된다.) 📚포스터 내용이번 포스터에서는 flask로 간단하게 포스터를 작성하고 글 목록을 확인하는 기능을..

Backend 2024.04.24

git switch시 발생하는 오류 error: Your local changes to the following files would be

📌 에러현재 브랜치 작업 중 다른 브랜치로 이동을 하려고git swtich 을 했는데 에러가 떴다 에러 내용error: Your local changes to the following files would be overwritten by checkout:... Please commit your changes or stash them before you switch branches. Aborting 에러 발생 이유다른 브랜치로 이동하기 전, 작업하고 있던 브랜치에서 변경사항을 제대로 커밋하지 않아 생긴 오류📃 해결 방법에러 밑에 문구를 보면 브랜치 변경 전에 , commit을 하거나 stash(변경사항을 일시적으로 저장) 하라고 한다. 1. commit add -> commit..

Git 2024.04.24