diff --git a/solutions/beecrowd/1084/1084.py b/solutions/beecrowd/1084/1084.py new file mode 100644 index 00000000..8663bbea --- /dev/null +++ b/solutions/beecrowd/1084/1084.py @@ -0,0 +1,27 @@ +import sys + + +def remove(_str, index): + if index == len(_str) - 1: + return _str[:-1] + elif index == 0: + return _str[1:] + return _str[:index] + _str[index + 1 :] + + +for line in sys.stdin: + n, d = map(int, line.split()) + + if not n and not d: + break + + prize = input() + + while d: + possibilities = [remove(prize, i) for i, _ in enumerate(prize)] + possibilities.sort(key=int) + prize = possibilities[-1] + + d -= 1 + + print(prize) diff --git a/solutions/beecrowd/1084/WRONG b/solutions/beecrowd/1084/WRONG new file mode 100644 index 00000000..e69de29b diff --git a/solutions/beecrowd/1084/generate_in.sh b/solutions/beecrowd/1084/generate_in.sh new file mode 100644 index 00000000..e69de29b diff --git a/solutions/beecrowd/1084/in.txt b/solutions/beecrowd/1084/in.txt new file mode 100644 index 00000000..06a76008 --- /dev/null +++ b/solutions/beecrowd/1084/in.txt @@ -0,0 +1,15 @@ +30 10 +145276763522376489625376239619 +10 3 +9821122098 +8 4 +95111451 +40 20 +9387678903215673421345672345643212364555 +15 13 +982311121123976 +5 2 +10021 +10 3 +1000010001 +0 0 diff --git a/solutions/beecrowd/1084/out.txt b/solutions/beecrowd/1084/out.txt new file mode 100644 index 00000000..e627f02e --- /dev/null +++ b/solutions/beecrowd/1084/out.txt @@ -0,0 +1,7 @@ +77676489625376239619 +9822298 +9551 +99772345643212364555 +99 +121 +1010001 diff --git a/solutions/beecrowd/1084/problem.md b/solutions/beecrowd/1084/problem.md new file mode 100644 index 00000000..4e69c65e --- /dev/null +++ b/solutions/beecrowd/1084/problem.md @@ -0,0 +1,31 @@ +https://www.beecrowd.com.br/judge/en/problems/view/1084 + +# Erasing and Winning + +Juliano is a fan of the TV show Erasing and Winning, where participants are +selected in a draw and receive money for taking part in the show. + +In the show, the presenter writes a number of N digits on a board. Then the +participant must erase exactly D digits from the number on the board; the number +formed by the remaining digits is the value of the money prize for the +participant. + +Juliano was finally selected to take part in the show, and asked you to write a +program that, give the number the presenter wrote on the board, and the number +of digits Juliano must erase, determines the highest value of the prize he can +win. + +## Input + +The input contains several test cases. The first line of a test case contains +two integers $N$ and $D (1 \leq D \lt N \leq 10^5)$ indicating respectively the number of +digits of the number the presenter wrote in the board and the number of digits +that must be erased. The next line contains the number the presenter wrote; the +number does not start with a zero. + +The end of input is indicated by a line containing only two zeros, separated by +a space. +## Output + +For each test case in the input your program must produce one single line in the +output, containing the highest prize Juliano can win. diff --git a/solutions/beecrowd/1084/tags.txt b/solutions/beecrowd/1084/tags.txt new file mode 100644 index 00000000..fef083f0 --- /dev/null +++ b/solutions/beecrowd/1084/tags.txt @@ -0,0 +1 @@ +paradigms