PS & Algorithm

    [백준] 6137번: 문자열 생성 풀이

    사용한 기술 스택들: 6137번: 문자열 생성 (acmicpc.net) 6137번: 문자열 생성 첫 번째 줄에 문자열 S의 길이 N이 주어진다. (N

    [백준] 1679번: 숫자놀이 풀이

    사용한 기술 스택들: 1679번: 숫자놀이 (acmicpc.net) 1679번: 숫자놀이 홀순이(holsoon)와 짝순이(jjaksoon) 둘이서 숫자 게임을 한다. 예를 들어, 정수 1과 3이 주어지고, 이 둘을 통틀어 5번까지 마음대로 사용하여 그 합을 구하여 1,2,3,…을 만드는 놀이다. 이 경우 먼저 www.acmicpc.net 코드: import sys input = lambda: sys.stdin.readline().rstrip() n = int(input()) l=list(map(int,input().split())) nums = set(l) k = int(input()) dp=[float('inf') for _ in range(l[-1]*k+2)] for i in range(1,l[-1]..

    [백준] 17615번: 볼 모으기 풀이

    [백준] 17615번: 볼 모으기 풀이

    사용한 기술 스택들: 17615번: 볼 모으기 (acmicpc.net) 17615번: 볼 모으기 첫 번째 줄에는 볼의 총 개수 N이 주어진다. (1 ≤ N ≤ 500,000) 다음 줄에는 볼의 색깔을 나타내는 문자 R(빨간색 볼) 또는 B(파란색 볼)가 공백 없이 주어진다. 문자열에는 R 또는 B 중 한 종류만 주 www.acmicpc.net 코드: import sys input = lambda: sys.stdin.readline().rstrip() def move_balls(type_of_ball_to_move,s): s=s.lstrip(type_of_ball_to_move) return s.count(type_of_ball_to_move) n = int(input()) s=input() # To co..

    [백준] 1437번: 수 분해 풀이 (수학적 증명 포함)

    사용한 기술 스택들: 1437번: 수 분해 (acmicpc.net) 1437번: 수 분해 첫째 줄에 음이 아닌 정수 N이 주어진다. N은 1,000,000보다 작거나 같다. www.acmicpc.net 이 문제는 수를 1개 이상의 정수로 분해해서 그 분해한 수들의 곱의 최댓값을 구하는 문제이다. 수학적인 증명이 인터넷에 한국어로 없길래 블로그를 써본다. 증명의 대한 아이디어는 여기서 얻었다. Breaking an Integer to get Maximum Product - GeeksforGeeks Breaking an Integer to get Maximum Product - GeeksforGeeks A Computer Science portal for geeks. It contains well writt..

    [백준] 3602번: iChess 파이썬 풀이

    [백준] 3602번: iChess 파이썬 풀이

    사용한 기술 스택들: 3602번: iChess (acmicpc.net) 3602번: iChess The Jury of NEERC’07 quarterfinals is proud to present you a new game — chess patience. This patience is played not with cards, but with black and white square tiles. The goal of the game is to place these tiles on a flat surface so that they form a sq www.acmicpc.net 3602번: iChess 코드 # O(1) import sys input = sys.stdin.readline n,m=sorted(ma..