Loading...

제켄도르프 분해 응용 - 정수를 피보나치 수의 합과 차로 표현하기

1. 문제 8229번: Fibonacci Representation (acmicpc.net) 8229번: Fibonacci Representation The Fibonacci sequence is a sequence of integers, called Fibonacci numbers, defined as follows: Fib0=0, Fib1=1, Fibn=Fibn-2+Fibn-1 for n > 1 Its initial elements are: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ... Byteasar investigates representations of number www.acmicpc.net 2. 풀이 어떤 정수를 최소 개수의 피보나치 수만을 사용해서 합과 차로 표현..

2023. 8. 27. 01:22

키타마사 법(kitamasa method, きたまさ法)에 대한 공부

1. 키타마사 법(kitamasa method) 수열 $a_{n}$의 점화식을 이전의 몇개 항으로 정의한다면, 귀납적 정의, 재귀적 수열 등으로 부른다. $$a_{n} = \sum_{i = 1}^{k} w_{i}a_{n-i}$$ 이런 형태로 정의되는 대표적인 수열은 피보나치 수열이다. $$a_{n} = a_{n-1} + a_{n-2}, w_{1} = w_{2} = 1, k = 2$$ 이 피보나치 수열의 가장 빠른? 해법중 하나는 행렬을 이용하는 방법이다. https://deepdata.tistory.com/760 행렬을 이용한 피보나치 수열 문제의 해법 1. 피보나치 수열의 행렬 표현 피보나치 수열의 점화식은 다음과 같다. $a_{n+1} = a_{n} + a_{n-1}$ $a_{n} = a_{n} + ..

이항정리를 이용한 거듭제곱의 합 1^k+2^k+3^k+...+n^k 을 구하는 방법

1. 이항정리(binomial theorem) 0이상의 정수 n과 음이 아닌 정수 x,y에 대하여, $$(x+y)^{n} = \sum_{k = 0}^{n}\binom{n}{k}x^{k}y^{n-k}$$ https://en.wikipedia.org/wiki/Binomial_theorem Binomial theorem - Wikipedia From Wikipedia, the free encyclopedia Algebraic expansion of powers of a binomial In elementary algebra, the binomial theorem (or binomial expansion) describes the algebraic expansion of powers of a binomial. ..

gcd와 xor의 성질, 연속하는 두 자연수는 서로소, dict보다 list를 먼저 고려하기

1. 문제 21004번: GCD vs. XOR (acmicpc.net) 21004번: GCD vs. XOR For each test case output a single integer: the number of pairs $(a_i, a_j)$ with $i y이면 p-q ..

2023. 8. 13. 00:01

연속하는 두 소수 차이는 생각보다 크지 않다(prime gap)

https://en.wikipedia.org/wiki/Prime_gap Prime gap - Wikipedia Number 1 to 27 # gn pn n 1 1 2 1 2 2 3 2 3 4 7 4 4 6 23 9 5 8 89 24 6 14 113 30 7 18 523 99 8 20 887 154 9 22 1,129 189 10 34 1,327 217 11 36 9,551 1,183 12 44 15,683 1,831 13 52 19,609 2,225 14 72 31,397 3,385 15 86 155,921 14,357 16 96 360,653 30,802 17 en.wikipedia.org 1. 문제 23005번: Consecutive Primes (acmicpc.net) 23005번: Consecut..

2023. 8. 8. 03:06

문자열 해싱(hashing) 기본 개념 배우기

String Hashing - Algorithms for Competitive Programming (cp-algorithms.com) String Hashing - Algorithms for Competitive Programming String Hashing Hashing algorithms are helpful in solving a lot of problems. We want to solve the problem of comparing strings efficiently. The brute force way of doing so is just to compare the letters of both strings, which has a time complexity of $O(\mi cp-algori..