분류 전체보기 54

백준 10689 Hamza

https://www.acmicpc.net/problem/10689 10689번: Hamza Hamza Darwish (AKA cpphamza) (an ICPC world finalist who participated in the 2006 ICPC in Texas and the 2008 ICPC in Banff, a previous software engineer at IBM and a current one at imo.im) decided one day with his coach Mohamed Mahmoud Abd El-Wahab (AKA fe www.acmicpc.net 문제 해설 각 테스트 케이스마다 문제 수가 주어지고 문제마다 문제가 속한 카테고리가 주어진다. 주인공은 첫 문제부터 문제를 푸는데,..

알고리즘/백준 2021.12.27

백준 10527 Judging Troubles

https://www.acmicpc.net/problem/10527 10527번: Judging Troubles The NWERC organisers have decided that they want to improve the automatic grading of the submissions for the contest, so they now use two systems: DOMjudge and Kattis. Each submission is judged by both systems and the grading results are compared to make s www.acmicpc.net 문제 해설 DOM과 Kattis에서 각각 채점한 기록이 주어지는데, 각각의 기록의 순서가 뒤죽박죽이 되었다. 이..

알고리즘/백준 2021.12.27

백준 9733 꿀벌

https://www.acmicpc.net/problem/9733 9733번: 꿀벌 각각의 일을 한 횟수와 비율을 공백으로 구분하여 출력한다. 출력은 {Re,Pt,Cc,Ea,Tb,Cm,Ex} 순서대로 하며, 비율은 소수점 둘째 자리까지 출력한다. 주어진 목록에 없는 일은 출력하지 않는다. 입력의 www.acmicpc.net 문제 해설 꿀벌이 하는 일들의 총 횟수, 각각의 횟수를 기록하고, 횟수와 전체 대비 비율을 출력하는 문제다. #include #define fio cin.tie(0)->sync_with_stdio(0) using namespace std; #include #include #include #include int main(){ fio; map map_; string S; double to..

알고리즘/백준 2021.12.27

백준 8641 Sklep

https://www.acmicpc.net/problem/8641 8641번: Sklep W pierwszym wierszu powinna się znaleźć liczba P określająca ilość różnych produktów przywiezionych tego dnia do sklepu. Każda z kolejnych $P$ linii zawiera dwie liczby $A$ i $S$, gdzie $A$ to numer produktu, zaś $S$ to sumaryczna ilość j www.acmicpc.net 문제 해설 정수 n과 n개의 줄에 정수 두 개씩 짝지어(a, b) 입력받는다. 각각의 a가 나온 순서대로, 각각의 a에 해당하는 b들의 합을 출력한다. #include..

알고리즘/백준 2021.12.27

백준 6973 Dynamic Dictionary Coding

https://www.acmicpc.net/problem/6973 6973번: Dynamic Dictionary Coding A common method of data compression, "dictionary coding", is to replace words in a text by numbers indicating their positions in a dictionary. Static dictionary coding, in which the dictionary is known in advance, can be problematic, as it is necessary to www.acmicpc.net 문제 해설 테스트 케이스의 수가 주어지고, 테스트 케이스마다 압축되어야 할 문장이 주어진다. 문장을 ..

알고리즘/백준 2021.12.27

백준 6325 Definite Values

https://www.acmicpc.net/problem/6325 6325번: Definite Values Assume that before the execution of the given program part, variable a has some definite value, while all other variables are undefined. You have to print the names of the variables which have a definite value after the execution of the program part. More www.acmicpc.net 해설 변수를 선언하고 초기화를 하지 않으면 이상한 값이 들어가기 때문에 값을 특정할 수 없다. 1. a의 값은 특정할 ..

알고리즘/백준 2021.12.27

백준 5608 問題 2

https://www.acmicpc.net/problem/5608 5608번: 問題 2 入力ファイルには, 変換表(最初の n + 1 行)に続き変換するデータ(n + 2 行目以降)が書いてある. 1 行目に変換表の行数 n, 続く n 行の各行は, 空白をはさんで 2 つの文字, さらに続け www.acmicpc.net ㅎ.. 입력 해설 정수 n n개의 줄에, 문자 a, b (a -> b 매핑할 것) 정수 m m개의 줄에, 문자 sth 문제 해설 1. map을 이용해 매핑할 값들을 저장한다. 2. m개의 문자를 입력받으며 2-1. 매핑 테이블에 있는 경우 매핑한 값을, 2-2. 없는 경우 값 그대로를 3. 출력할 문자열에 순서대로 추가한다. #include #define fio cin.tie(0)->sync_with_st..

알고리즘/백준 2021.12.27

백준 4775 Spelling Be

https://www.acmicpc.net/problem/4775 4775번: Spelling Be The input consists of two sections, the dictionary and the emails. The first line of input specifies the number of words in the dictionary, followed by that many lines, with one word per line. There is no whitespace before, after, or in any words, although www.acmicpc.net 입력 정수 N N개의 단어(사전에 등재할 단어) 정수 M M개의 email (마지막 한 줄은 '-1'로 끝난다) 문제 해설 ..

알고리즘/백준 2021.12.27

백준 4351 Hay Points

https://www.acmicpc.net/problem/4351 4351번: Hay Points The first line of input contains 2 positive integers: m n; getline(cin, s); 위와 같은 코드에서 n에 정수(ex : 9)를 입력(enter = '\n')하는 경우, n에 9가 입력되고, 입력 버퍼에 개행 문자가 남게 된다. 이후 getline이 남아있던 개행 문자를 입력받고, s에는 아무 값도 들어가지 않게 된다. #include #define fio cin.tie(0)->sync_with_stdio(0) using namespace std; #include #include int main(){ fio; int M, N; cin >> M >> N; ..

알고리즘/백준 2021.12.27

백준 4158 CD

https://www.acmicpc.net/problem/4158 4158번: CD 입력은 여러 개의 테스트 케이스로 이루어져 있다. 각 테스트 케이스의 첫째 줄에는 상근이가 가지고 있는 CD의 수 N, 선영이가 가지고 있는 CD의 수 M이 주어진다. N과 M은 최대 백만이다. 다음 줄 www.acmicpc.net 상근이가 가진 CD의 목록, 선영이가 가진 CD의 목록이 각각 오름차순으로 주어질 때, 두 사람이 공통으로 갖고있는 CD의 갯수를 찾는 문제다. 시간초과 코드 / 통과 코드는 아래에 상근이의 CD 목록을 set에 넣고, 선영이의 CD 목록을 차례로 순회하며 특정 CD가 상근이의 목록에도 있는지 확인하는 코드다. 문제를 읽고 바로 무난하게 통과하겠거니~ 제출했는데 시간초과가 나왔다. 0. 시간제..

알고리즘/백준 2021.12.26