Problem Solving

Problem Solving/BaekJoon

[BOJ/백준] 9655 - 돌 게임

9655번: 돌 게임 상근이가 게임을 이기면 SK를, 창영이가 게임을 이기면 CY을 출력한다. www.acmicpc.net 홀수 상근 짝수 창영 제목 돌 게임 조건 시간 제한 : 1 초 메모리 제한 : 128 MB 문제 돌 게임은 두 명이서 즐기는 재밌는 게임이다. 탁자 위에 돌 N개가 있다. 상근이와 창영이는 턴을 번갈아가면서 돌을 가져가며, 돌은 1개 또는 3개 가져갈 수 있다. 마지막 돌을 가져가는 사람이 게임을 이기게 된다. 두 사람이 완벽하게 게임을 했을 때, 이기는 사람을 구하는 프로그램을 작성하시오. 게임은 상근이가 먼저 시작한다. 입력 첫째 줄에 N이 주어진다. (1 ≤ N ≤ 1000) 출력 상근이가 게임을 이기면 SK를, 창영이가 게임을 이기면 CY을 출력한다. 예제 입력1 예제 출력1..

Problem Solving/BaekJoon

[BOJ/백준] 16562 - 친구비

16562번: 친구비 첫 줄에 학생 수 N (1 ≤ N ≤ 10,000)과 친구관계 수 M (0 ≤ M ≤ 10,000), 가지고 있는 돈 k (1 ≤ k ≤ 10,000,000)가 주어진다. 두번째 줄에 N개의 각각의 학생이 원하는 친구비 Ai가 주어진다. (1 ≤ Ai ≤ 10, www.acmicpc.net union할 때, 친구비가 더 작은 root가 기준이 되어야한다 제목 친구비 조건 시간 제한 : 2 초 메모리 제한 : 512 MB 문제 19학번 이준석은 학생이 N명인 학교에 입학을 했다. 준석이는 입학을 맞아 모든 학생과 친구가 되고 싶어한다. 하지만 준석이는 평생 컴퓨터랑만 대화를 하며 살아왔기 때문에 사람과 말을 하는 법을 모른다. 그런 준석이에게도 희망이 있다. 바로 친구비다! 학생 i에..

Problem Solving/BaekJoon

[BOJ/백준] 25270 - 99 Problems

25270번: 99 Problems Print one integer, the closest positive integer that ends in $99$. In case of a tie, print the bigger one. www.acmicpc.net % 100 제목 99 Problems 조건 시간 제한 : 1 초 메모리 제한 : 1024 MB 문제 Ingrid is the founder of a company that sells bicycle parts. She used to set the prices of products quite arbitrarily, but now she has decided that it would be more profitable if the prices end in $9..

Problem Solving/BaekJoon

[BOJ/백준] 25527 - Counting Peaks of Infection

25527번: Counting Peaks of Infection For the new infectious disease, COVID-99, numbers of new positive cases of PCR tests conducted in the city are reported daily. You are requested by the municipal public relations department to write a program that counts the number of the peaks so far of t www.acmicpc.net 1. up이 true인 상태에서 down이 확인되면 볼록 count++ 2. 볼록 체크 시, up & down false로 초기화 제목 Counting Peak..

Problem Solving/BaekJoon

[BOJ/백준] 25311 - UCPC에서 가장 쉬운 문제 번호는?

25311번: UCPC에서 가장 쉬운 문제 번호는? 대회 참가자는 되도록 일찍 대회의 모든 문제를 한 번씩 읽어 보는 것이 권장됩니다. 이렇게 하면 대회의 전체적인 분위기를 느낄 수 있고, 종종 비교적 쉬운 문제를 빨리 발견해서 속도에서 우 www.acmicpc.net 항상 A번이 쉬웠지 제목 오큰수 조건 시간 제한 : 0.5 초 메모리 제한 : 1024 MB 문제 대회 참가자는 되도록 일찍 대회의 모든 문제를 한 번씩 읽어 보는 것이 권장됩니다. 이렇게 하면 대회의 전체적인 분위기를 느낄 수 있고, 종종 비교적 쉬운 문제를 빨리 발견해서 속도에서 우위를 점할 수도 있습니다. 하지만 실제 참가자들은 다양한 전략을 사용하고, 문제들이 배치된 순서에 따라서 일부 문제를 아예 읽지 못하거나 아주 늦은 시점에 ..

Problem Solving/BaekJoon

[BOJ/백준] 17298 - 오큰수

17298번: 오큰수 첫째 줄에 수열 A의 크기 N (1 ≤ N ≤ 1,000,000)이 주어진다. 둘째 줄에 수열 A의 원소 A1, A2, ..., AN (1 ≤ Ai ≤ 1,000,000)이 주어진다. www.acmicpc.net 제목 오큰수 조건 시간 제한 : 1 초 메모리 제한 : 512 MB 문제 크기가 N인 수열 A = A1, A2, ..., AN이 있다. 수열의 각 원소 Ai에 대해서 오큰수 NGE(i)를 구하려고 한다. Ai의 오큰수는 오른쪽에 있으면서 Ai보다 큰 수 중에서 가장 왼쪽에 있는 수를 의미한다. 그러한 수가 없는 경우에 오큰수는 -1이다. 예를 들어, A = [3, 5, 2, 7]인 경우 NGE(1) = 5, NGE(2) = 7, NGE(3) = 7, NGE(4) = -1이다..

Problem Solving/BaekJoon

[BOJ/백준] 14500 - 테트로미노

14500번: 테트로미노 폴리오미노란 크기가 1×1인 정사각형을 여러 개 이어서 붙인 도형이며, 다음과 같은 조건을 만족해야 한다. 정사각형은 서로 겹치면 안 된다. 도형은 모두 연결되어 있어야 한다. 정사각형의 변 www.acmicpc.net 제목 테트로미노 조건 시간 제한 : 2 초 메모리 제한 : 512 MB 문제 폴리오미노란 크기가 1×1인 정사각형을 여러 개 이어서 붙인 도형이며, 다음과 같은 조건을 만족해야 한다. 정사각형은 서로 겹치면 안 된다. 도형은 모두 연결되어 있어야 한다. 정사각형의 변끼리 연결되어 있어야 한다. 즉, 꼭짓점과 꼭짓점만 맞닿아 있으면 안 된다. 정사각형 4개를 이어 붙인 폴리오미노는 테트로미노라고 하며, 다음과 같은 5가지가 있다. 아름이는 크기가 N×M인 종이 위에..

Problem Solving/BaekJoon

[BOJ/백준] 24957 - Loop of Chocolate

24957번: Loop of Chocolate Output in a line the volume of the union of the spheres. Relative error of the output should be within $10^{-7}$. www.acmicpc.net pi의 소숫점을 오차범위보다 더 크게 잡기 제목 Loop of Chocolate 조건 시간 제한 : 2 초 메모리 제한 : 1024 MB 문제 Let’s make sweets of a fancy shape that is a loop of chocolate. The shape of a loop is formed by a union of a number of spheres of the same size, where every sphe..

Problem Solving/BaekJoon

[BOJ/백준] 17352 - 여러분의 다리가 되어 드리겠습니다!

> N; initRoot(N); for(int n = 0 ; n > from >> to; unionRoot(from, to); } int tmp = findRoot(1); for(int n = 2 ; n

Problem Solving/CodeForces

[Codeforces/코드포스] Codeforces Round #817 (Div. 4) D - Line

Problem - D - Codeforces codeforces.com 절반을 나눠서 왼쪽 부분에 있는 사람이 오른쪽을 보고 오른쪽 부분에 있는 사람이 왼쪽을 봐야 최대값을 가진다 제목 Line 조건 time limit per test : 2 second memory limit per test : 256 megabytes input : standard input output : standard output 문제 There are n people in a horizontal line, each looking either to the left or the right. Each person counts the number of people in the direction they are looking. The ..

Problem Solving/CodeForces

[Codeforces/코드포스] Codeforces Round #817 (Div. 4) C - Word Game

Problem - C - Codeforces codeforces.com map 제목 Word Game 조건 time limit per test : 1 second memory limit per test : 256 megabytes input : standard input output : standard output 문제 Three guys play a game: first, each person writes down n distinct words of length 3. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was w..

Problem Solving/CodeForces

[Codeforces/코드포스] Codeforces Round #817 (Div. 4) B - Colourblindness

Problem - B - Codeforces codeforces.com Green == Blue 제목 Colourblindness 조건 time limit per test : 1 second memory limit per test : 256 megabytes input : standard input output : standard output 문제 Vasya has a grid with 2 rows and n columns. He colours each cell red, green, or blue. Vasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the gri..

JunHoChoi
'Problem Solving' 카테고리의 글 목록 (10 Page)