본문 바로가기

Algorithm

(2139)
(C++) - 백준(BOJ) 8674 : Tabliczka https://www.acmicpc.net/problem/8674 8674번: Tabliczka Mama przyniosła Piotrusiowi i Pawełkowi tabliczkę czekolady o wymiarach a i b. Chłopcy chcą podzielić tabliczkę za pomocą jednego prostego łamania, wzdłuż kostek pionowych lub poziomych. Chłopcy chcą podzielić tabliczkę jak najbardziej spra www.acmicpc.net 수학문제였습니다. 📕 풀이방법 📔 입력 및 초기화 일차원 배열 a를 long long 형으로 선언합니다. int의 범위는 -2^31 ~ 2^31까지이기 때문..
(C++) - 백준(BOJ) 6162 : Superlatives https://www.acmicpc.net/problem/6162 6162번: Superlatives Typically, droughts are classified into “abnormally dry”, “moderate drought”, “severe drought”, “extreme drought”, and “exceptional drought”. The current drought is so “exceptional” in most of California that there have been discuss www.acmicpc.net 구현문제였습니다. 📕 풀이방법 📔 입력 및 초기화 1. 테스트 케이스 개수 t를 선언 후 입력해줍니다. 2. t만큼 for loop를 수행하며 expected, ac..
(C++) - 백준(BOJ) 6138 : Speed Reading 보호되어 있는 글입니다.
(C++) - 백준(BOJ) 6060 : Wheel Rotation https://www.acmicpc.net/problem/6060 6060번: Wheel Rotation Farmer John has an old-time thresher (wheat harvester) that requires belts to be installed on various gears to turn the parts. The engine drives pulley 1 in a clockwise direction which attaches via a belt to pulley 2. Pulley 2 attaches via a belt to pulley www.acmicpc.net 구현 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 1. n, 현재위치 cur, gear가 도는 방향 curDir을 선..
(C++) - 백준(BOJ) 5751 : Head or Tail https://www.acmicpc.net/problem/5751 5751번: Head or Tail John and Mary have been friends since nursery school. Since then, they have shared a playful routine: every time they meet, they play Head or Tail with a coin, and whoever wins has the privilege of deciding what they are going to play during the day. Mary www.acmicpc.net 구현문제였습니다. 📕 풀이방법 📔 입력 및 초기화 test case n을 선언 후 while loop를 수행하며 입력해줍니다..
(C++) - 백준(BOJ) 5692 : 팩토리얼 진법 https://www.acmicpc.net/problem/5692 5692번: 팩토리얼 진법 상근이는 보통 사람들이 사는 것과는 조금 다른 삶을 사는 사람이다. 상근이는 이런 사람들의 시선이 부담스럽기 때문에, 자신만의 숫자를 개발하기로 했다. 바로 그 이름은 팩토리얼 진법이다. www.acmicpc.net 구현문제였습니다. 📕 풀이방법 📔 입력 및 초기화 테스트 케이스의 수가 주어지지 않았기 때문에 최대한 빠르게 입출력을 위해 c library와의 동기화를 끊어줍니다.while loop를 수행하면서 입력받습니다. 📔 풀이과정 getFacNum함수 내부에는 getFac함수가 동작합니다. getFac은 팩토리얼 수를 구한 결과를 반환하는 함수며 이 값을 토대로 팩토리얼 진법의 수를 getFacNum함수에서..
(C++) - 백준(BOJ) 5607 : 問題 1 https://www.acmicpc.net/problem/5607 5607번: 問題 1 A と B の 2 人のプレーヤーが, 0 から 9 までの数字が書かれたカードを使ってゲームを行う. 最初に, 2 人は与えられた n 枚ずつのカードを, 裏向きにして横一列に並べる. その後, 2 人 www.acmicpc.net 구현 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 게임 라운드 횟수 n, a의 점수 aScore, b의 점수 bScore를 선언 후 입력해줍니다.이후 n만큼 loop를 수행하며 각각 뒤집은 카드의 숫자를 의미하는 a, b를 선언 후 입력해줍니다. 📔 풀이과정 조건에 따라 aScore, bScore에 더해줍니다. 📔 정답출력 aScore, bScore를 출력해줍니다. 📕 Code #include using n..
(C++) - 백준(BOJ) 5235 : Even Sum More Than Odd Sum https://www.acmicpc.net/problem/5235 5235번: Even Sum More Than Odd Sum When new programs arrive in the grid world, they start by playing the simplest of games in the Disc Arena against other novice programs. One of those games is played in front of a large board as follows: a sequence of numbers appears on the board, and the www.acmicpc.net 구현 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 1. 테스트 케이스 t를 선언 후 입력받습니다...