본문 바로가기
728x90
반응형

코딩테스트15

[Codility] Lesson12 - Euclidean algorithm: Common Prime Divisors Problem A prime is a positive integer X that has exactly two distinct divisors: 1 and X. The first few prime integers are 2, 3, 5, 7, 11 and 13. A prime D is called a prime divisor of a positive integer P if there exists a positive integer K such that D * K = P. For example, 2 and 5 are prime divisors of 20. You are given two positive integers N and M. The goal is to check whether the sets of pr.. 2021. 2. 9.
[Codility] Lesson12 - euclidean algorithm: Chocolates By Numbers Problem Two positive integers N and M are given. Integer N represents the number of chocolates arranged in a circle, numbered from 0 to N − 1. You start to eat the chocolates. After eating a chocolate you leave only a wrapper. You begin with eating chocolate number 0. Then you omit the next M − 1 chocolates or wrappers on the circle, and eat the following one. More precisely, if you ate chocolat.. 2021. 2. 8.
[Codility] Lesson10 - Prime and composite numbers: MinPerimeterRectangle Problem n integer N is given, representing the area of some rectangle. The area of a rectangle whose sides are of length A and B is A * B, and the perimeter is 2 * (A + B). The goal is to find the minimal perimeter of any rectangle whose area equals N. The sides of this rectangle should be only integers. For example, given integer N = 30, rectangles of area 30 are: (1, 30), with a perimeter of 6.. 2021. 1. 30.
[Atcoder] D - Friends (C++) Problem Problem Statement There are NN persons called Person 11 through Person NN. You are given MM facts that "Person AiAi and Person BiBi are friends." The same fact may be given multiple times. If XX and YY are friends, and YY and ZZ are friends, then XX and ZZ are also friends. There is no friendship that cannot be derived from the MM given facts. Takahashi the evil wants to divide the NN pe.. 2021. 1. 13.
728x90
반응형