본문 바로가기

Algorithm

(2139)
(Python) - 백준(BOJ) 6976 : Divisibility by 11 https://www.acmicpc.net/problem/6976 6976번: Divisibility by 11 For each positive integer in the input, the output consists of a series of numbers formed as a digit is deleted and subtracted, followed by a message indicating whether or not the original number is divisible by 11. Outputs for different positive integers www.acmicpc.net 구현 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 1. test case t를 선언 후 입력해줍니다. 2. t만..
(C++) - 백준(BOJ) 15751 : Teleportation https://www.acmicpc.net/problem/15751 15751번: Teleportation The first and only line of input contains four space-separated integers: $a$ and $b$, describing the start and end locations, followed by $x$ and $y$, describing the teleporter. All positions are integers in the range $0 \ldots 100$, and they are not neces www.acmicpc.net 구현 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 a, b좌표를 저장할 일차원 배열 ab. x, y좌표를 저장할 일..
(C++) - 백준(BOJ) 6975 : Deficient, Perfect, and Abundant https://www.acmicpc.net/problem/6975 6975번: Deficient, Perfect, and Abundant Write a program that repeatedly reads a positive integer, determines if the integer is deficient, perfect, or abundant, and outputs the number along with its classification. A positive integer, n, is said to be perfect if the sum of its proper diviso www.acmicpc.net brute force문제였습니다. 📕 풀이방법 📔 입력 및 초기화 test case의 개수 t를 ..
(Python) - 백준(BOJ) 6974 : Long Division https://www.acmicpc.net/problem/6974 6974번: Long Division In days of yore (circa 1965), mechanical calculators performed division by shifting and repeated subtraction. For example, to divide 987654321 by 3456789, the numbers would first be aligned by their leftmost digit (see (1) below), and the divisor subtracte www.acmicpc.net 몫과 나머지를 출력하는 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 test case n을 입력해줍니다. 📔 풀이과정 ..
(C++) - 백준(BOJ) 6811 : Old Fishin’ Hole https://www.acmicpc.net/problem/6811 6811번: Old Fishin’ Hole You will be given 4 integers, one per line, representing trout points, pike points, pickerel points, and total points allowed in that order. You can assume that each integer will be greater than 0 and less than or equal to 100. www.acmicpc.net 모든 조합을 찾는 brute force 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 각 물고기 이름에 대한 점수를 저장할 변수를 선언하고 입력받습니다. 총 조합의 개..
(C++) - 백준(BOJ) 6794 : What is n, Daddy? https://www.acmicpc.net/problem/6794 6794번: What is n, Daddy? Natalie is learning to count on her fingers. When her Daddy tells her a number n (1 ≤ n ≤ 10), she asks “What is n, Daddy?”, by which she means “How many fingers should I hold up on each hand so that the total is n?” To make matters simple, her www.acmicpc.net 구현 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 만들 수를 n, 그 때의 순서쌍의 한 쪽을 저장하기 위한 배열 check를 선언합니..
(C++) - 백준(BOJ) 23971 : ZOAC 4 https://www.acmicpc.net/problem/23971 23971번: ZOAC 4 i행 j열 자리를 (i, j)라고 할 때, (1,1)에 참가자가 앉은 경우 다른 참가자는 (1,2), (2,1), (2,2) 자리를 제외한 나머지 자리에 앉을 수 있다. (2,2)의 경우는 (1,1)과 행 번호 및 열 번호의 차가 1보다 크 www.acmicpc.net 구현문제였습니다. 📕 풀이방법 📔 입력 및 초기화 행 h, 열 w, 띄어 앉아야 하는 세로 길이 n, 띄어 앉아야 하는 가로 길이 m을 선언 후 입력해줍니다. 📔 풀이과정 가장 많이 앉는 방법은 가지런히 앉는 방법입니다. 앉은 형태를 봤을 때 가장 바깥쪽을 도형으로 그려보면 직사각형입니다. 정답은 세로에 앉은 인원 * 가로에 앉은 인원이 됩니다...
(C++) - 백준(BOJ) 6780 : Sumac Sequences https://www.acmicpc.net/problem/6780 6780번: Sumac Sequences In a sumac sequence, t1, t2, .., tm, each term is an integer greater than or equal 0. Also, each term, starting with the third, is the difference of the preceding two terms (that is, tn+2 = tn − tn+1 for n ≥ 1). The sequence terminates at tm if tm−1 www.acmicpc.net 구현문제였습니다. 📕 풀이방법 📔 입력 및 초기화 1. t1, t2, t2, 길이 cnt를 선언해줍니다. 2. t1, t2를 입력..