본문 바로가기

Programming

(102)
[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++] Project Euler #40 - Champernowne's Constant Champernowne’s constant is an irrational number created by concatenating natural numbers in order, such as 0.123456789101112131415…. The problem requires finding the digits at specific positions in this sequence and calculating the product of these digits. For example, the 1st digit after the decimal point is 1, the 2nd is 2, and the 10th is 1. By following this pattern, we need to extract the d..
[C/C++] Project Euler #39 - Integer Right Triangles Project Euler #39 is a relatively easy problem with a difficulty rating of 5%. As the title suggests, it is about Pythagorean triangles. A Pythagorean triangle is a right triangle where all side lengths are integers. The fundamental relationship for such a triangle follows the well-known Pythagorean theorem: \[ a^2 + b^2 = c^2 \] If there exists an integer triplet (x, y, z) satisfying the equati..
[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++] Project Euler #38 - Pandigital Multiples In Project Euler Problem 38, the goal is to use the concepts of “pandigital numbers” and “multiplication” to find the largest number that satisfies specific conditions. A pandigital number is defined as a number in which each digit from 1 to 9 appears exactly once. For example, 192384576 is considered a pandigital number because it contains all digits from 1 to 9 without repetition. The problem ..
[C/C++] Project Euler #37 - Truncatable Primes Truncatable Prime refers to a very special type of prime number. These numbers retain their primality even when digits are removed one by one from the left or from the right. For example, while a regular prime is defined as a number divisible only by 1 and itself, Truncatable Primes not only meet this condition but also require that all numbers formed by progressively removing digits remain prim..
[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++] Project Euler #36 - Double-base Palindromes Project Euler Problem #36 - “Double-base Palindromes” is about finding numbers that are palindromic in both decimal and binary representations.  For example, 585 is a palindrome in decimal (585) and also a palindrome in binary (1001001).  The task is to find such numbers, calculate their sum, and output the result.There are various ways to determine if a number is a palindrome and to generate pa..
[C/C++] Project Euler #35 - Circular Primes Project Euler’s Problem #35 deals with “circular primes.”  A circular prime is defined as a prime number such that every rotation of its digits is also a prime.  For example, consider 197: if you rotate its digits, you get 197, 971, and 719—all of which are prime. Therefore, 197 is a circular prime. The question asks how many such circular primes exist below 1,000,000. For reference, there are 1..
[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..

반응형