본문 바로가기

분류 전체보기

(66)
[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..
[C/C++] Project Euler #34 - Digit Factorials This problem is about finding numbers that are equal to the sum of the factorials of their digits.For example, the number 145 is such a number because\[1! + 4! + 5! = 1 + 24 + 120 = 145\]This problem asks you to find the sum of all such numbers.If you've been working on Project Euler problems up to this point, you probably have some experience with extracting digits from a decimal number.In my c..
[C/C++] Project Euler #33 - Digit Cancelling Fractions Project Euler #33 problem is about “Digit Cancelling Fractions.” This problem involves finding fractions where both the numerator and denominator are two-digit numbers and satisfy a specific condition. The condition is that when the numerator and denominator share the same digit, and this digit is “cancelled” in a simple way, the resulting fraction must still equal the original fraction.For exam..
[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++] Project Euler #32 - Pandigital Products Project Euler #32 is a relatively low-difficulty problem with a difficulty level of 5%.A pandigital number is a number formed by using all digits within a specific range exactly once. For example, combinations such as 123456789 or 391867254, which include all digits from 1 to 9 exactly once, are called pandigital. In this problem, the condition requires using all digits from 1 to 9 exactly once...
[C/C++] Project Euler #31 - Coin Sums In the UK, the following coin denominations are available:• 1p, 2p, 5p, 10p, 20p, 50p, £1 (100p), £2 (200p).The goal is to find the number of unique combinations of these coins that sum to 200 pence (£2).Conditions:1. Coins can be used repeatedly as needed.2. The order of coins does not matter (e.g., {1p, 2p} is considered the same as {2p, 1p}).3. Only unique combinations should be counted. In t..
[C/C++] Project Euler #30 - Digit Fifth Powers Project Euler problem #30 is about finding numbers that are equal to the sum of the fifth powers of their digits. The problem specifies that single-digit numbers do not satisfy the condition, so the search must start with at least two-digit numbers.To solve this, you calculate the sum of the fifth powers of each digit of a given number and check if this sum equals the original number.  The goal ..

반응형