본문 바로가기

Programming/BOJ

(28)
[C/C++] BOJ #1036 - Base 36 The problem “Baekjoon #1036 - Base 36” requires converting and maximizing a numerical value in base 36.In base 36, the digits range from 0-9 and A-Z, where ‘A’ represents 10, ‘B’ represents 11, …, and ‘Z’ represents 35. The input consists of several numbers written in base 36, and the task is to maximize the sum of these numbers by replacing at most one character (‘0’-‘Z’) with ‘Z’ (35) in all o..
[C/C++] BOJ #1032 - Command Prompt When working with files on a computer, wildcards (?) are often used to identify common patterns or to handle multiple files efficiently. In this problem, you need to determine a common pattern among multiple file names.You will be given N file names as input, and all file names have the same length. For each position in the file names, if all characters at that position are identical, you should..
[C/C++] BOJ #1026 - Treasure The problem “Treasure” (Baekjoon #1026) requires you to find the minimum possible sum of the product of two arrays, A and B.First, you are given two arrays, A and B, each containing N integers. You can rearrange the elements of A in any order, but the order of B must remain unchanged.The goal is to compute the sum of element-wise products between A and B such that the result is minimized. That i..
[C/C++] BOJ #1024 - Sum of Number Sequences. The problem “Sum of Number Sequences” (Baekjoon #1024) requires finding a sequence of consecutive integers whose sum equals a given number N, while ensuring that the length of the sequence is at least L. If multiple valid sequences exist, the shortest one should be chosen. If no such sequence can be found, the program should return -1.  The sum of a sequence depends on how the sequence is struct..
[C/C++] BOJ #1021 - Rotating Queues The Baekjoon problem #1021 “Rotating Queue” involves using a deque to efficiently extract elements from specific positions. The goal of the problem is to calculate the minimum number of operations required to extract the desired elements in the given order. The term “operation” here refers to either rotating the deque one step to the left, one step to the right, or directly removing the first el..
[C/C++] BOJ #1019 - Book Page Han Ji-min loves books and works at a library.  One spring night, while reading a book, she suddenly became curious about how many digits were written on the pages of the book she was flipping through.  The book’s pages are numbered from page 1 to page N. Let’s calculate how many digits are written on the pages of the book she read.  Although it’s a bit different from the original problem, I was..
[C/C++] BOJ #1018 - Paint Chess Board Again The Baekjoon #1018 - Paint Chess Board Again problem requires you to determine the minimum number of squares that need to be repainted on a given rectangular board so that it becomes a valid 8x8 chessboard.Problem Description:1. Input:• A board of size NxM (where N,M > 8).• Each cell of the board contains either 'W' (white) or 'B' (black).• A chessboard is valid if:• Adjacent cells (both horiz..
[C/C++] BOJ #1017 - Prime pairs The problem “Prime Pairs” requires finding a pair of prime numbers for a given even number  n  such that the sum of the two prime numbers equals  n . This problem is a variation of the famous Goldbach’s conjecture, which states that every even integer greater than 2 can be expressed as the sum of two prime numbers.Problem Description:1. You are given an even number  n  ( \(n \geq 4\) ).2. The ta..
[C/C++] BOJ #1016 Square Nono Number Problem Description:You are given two integers, min and max, which define a range of numbers [min, max]. Your task is to find how many numbers within this range are not divisible by the square of any integer greater than 1. Such numbers are called “non-square-free” numbers.In mathematical terms, a number x in the range [min, max] is considered not square-free if there exists an integer k > 1 suc..
[C/C++] BOJ #1015 Sorting Numbers The problem BOJ #1015 - Sorting Numbers requires the following:You are given an array  A  of size  N . Your task is to create a permutation  P  of length  N  such that:1. Rearranged Order: When the elements of  A  are rearranged according to  P , they form a non-decreasing sequence. Specifically, if  B  is the rearranged array, then  B[i] = A[P[i]]  should hold, and  B  must be sorted in ascendi..

반응형