목록수학 (48)
넘치게 채우기
https://codeforces.com/contest/2063/problem/DCodeforces Round 1000(Div. 2) - D. Game With Triangles문제 유형: 그리디, 수학, 기하학, 삼분 탐색, 구현, 투 포인터, 브루트 포스, 부분합, 구간합시간 제한: 2초메모리 제한: 256MB 문제There are n+m">n+m distinct points (a1,0),(a2,0),…,(an,0),(b1,2),(b2,2),…,(bm,2)">(a1,0),(a2,0),…,(an,0),(b1,2),(b2,2),…,(bm,2) on the plane. Initially, your score is 0">0. To increase your score, you can ..
https://www.acmicpc.net/problem/17387BOJ - 선분 교차 2문제 유형: 선형대수, 수학, 기하학문제 난이도: Gold II시간 제한: 0.25초메모리 제한: 512MB 문제2차원 좌표 평면 위의 두 선분 L1, L2가 주어졌을 때, 두 선분이 교차하는지 아닌지 구해보자. 한 선분의 끝 점이 다른 선분이나 끝 점 위에 있는 것도 교차하는 것이다.L1의 양 끝 점은 (x1, y1), (x2, y2), L2의 양 끝 점은 (x3, y3), (x4, y4)이다. 입력첫째 줄에 L1의 양 끝 점 x1, y1, x2, y2가, 둘째 줄에 L2의 양 끝 점 x3, y3, x4, y4가 주어진다. 출력L1과 L2가 교차하면 1, 아니면 0을 출력한다. 풀이처음에는 직선의 방정식을 이용해서..
https://codeforces.com/contest/2063/problem/ACodeforces Round 1000(Div.2) - A. Minimal Coprime문제 유형: 수학, 그리디시간 제한: 1초메모리 제한: 256MB 문제A segment of positive integers [l,r]">[l,r] is called coprime if l">l and r">r are coprime.A coprime segment [l,r]">[l,r] is called minimal coprime if it does not contain any coprime segment not equal to itself. To better understand this statement, you can refer to..
https://www.acmicpc.net/problem/27172BOJ - 수 나누기 게임문제 유형: 수학, 정수론문제 난이도: Gold IV시간 제한: 1초메모리 제한: 1024MB 문제《보드게임컵》을 준비하다 지친 은하는 보드게임컵 참가자들을 경기장에 몰아넣고 결투를 시키는 게임 《수 나누기 게임》을 만들었습니다.《수 나누기 게임》의 규칙은 다음과 같습니다.게임을 시작하기 전 각 플레이어는 1$1$부터 1000000$1\,000\,000$ 사이의 수가 적힌 서로 다른 카드를 잘 섞은 뒤 한 장씩 나눠 가집니다.매 턴마다 플레이어는 다른 플레이어와 한 번씩 결투를 합니다.결투는 서로의 카드를 보여주는 방식으로 진행되며, 플레이어의 카드에 적힌 수로 다른 플레이어의 카드에 적힌 수를 나눴을 때, 나머지..
https://www.acmicpc.net/problem/9527BOJ - 1의 개수 세기문제 유형: 누적합, 수학, 비트마스킹문제 난이도: Gold II시간 제한: 1초메모리 제한: 128MB 문제두 자연수 A, B가 주어졌을 때, A ≤ x ≤ B를 만족하는 모든 x에 대해 x를 이진수로 표현했을 때 1의 개수의 합을 구하는 프로그램을 작성하시오.즉, f(x) = x를 이진수로 표현 했을 때 1의 개수라고 정의하고, 아래 식의 결과를 구하자. ∑x=ABf(x)\[\sum_{x=A}^{B}{f(x)}\] 입력첫 줄에 두 자연수 A, B가 주어진다. (1 ≤ A ≤ B ≤ 10^16) 출력1의 개수를 세어 출력한다. 풀이어떤 수 2^i-1에 대한 점화식은 다음과 같다: pows[i]는 (1 i비트의 ..
https://codeforces.com/contest/2055/problem/DCodeforces Round 996(Div.2) - D. Scarecrow문제 유형: 그리디, 구현, 수학시간 제한: 2초메모리 제한: 256MB 문제A crow is sitting at position 0">0 of the number line. There are n">n scarecrows positioned at integer coordinates a1,a2,…,an">a1,a2,…,an along the number line. These scarecrows have been enchanted, allowing them to move left and right at a speed of 1">1unit pe..
https://codeforces.com/contest/2055/problem/CCodeforces Round 996(Div.2) - C. The Trail문제 유형: 행렬, 수학, 구현, 생성형시간 제한: 2초메모리 제한: 256MB 문제In the wilderness lies a region of mountainous terrain represented as a rectangular grid with n">n rows and m">m columns. Each cell in the grid is identified by its position (i,j)">(i,j), where i">i is the row index and j">j is the column index. The altitude of ce..
https://codeforces.com/contest/2055/problem/BCodeforces Round 996(Div.2) - B. Crafting문제 유형: 수학, 그리디시간 제한: 1초메모리 제한: 256MB 문제There are n">n different types of magical materials, numbered from 1">1 to n">n. Initially, you have ai">ai units of material i">i for each i">i from 1">1 to n">n. You are allowed to perform the following operation:Select a material i">i (where 1≤i≤n">1≤i≤n)...
https://codeforces.com/contest/2055/problem/ACodeforces Round 996(Div.2) - A. Two Frogs문제 유형: 구현, 수학, 그리디시간 제한: 1초메모리 제한: 256MB 문제There are n">n lilypads arranged in a row, numbered from 1">1 to n">n from left to right. Alice and Bob are frogs initially positioned on distinct lilypads, a">a and b">b, respectively. They take turns jumping, starting with Alice.During a frog's turn, it can jump eit..
https://codeforces.com/contest/2043/problem/DEducational Codeforces Round 173(Div.2) - D. Problem about GCD문제 유형: 수학, 브루트 포스, 그리디시간 제한: 1초메모리 제한: 256MB 문제Given three integers l">l, r">r, and G">G, find two integers A">A and B">B (l≤A≤B≤r">l≤A≤B≤r) such that their greatest common divisor (GCD) equals G">G and the distance |A−B|">|A−B| is maximized.If there are multiple..