Skip to content

Commit

Permalink
Add wrong solution
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Dec 27, 2023
1 parent ec8a384 commit c4e9255
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 0 deletions.
27 changes: 27 additions & 0 deletions solutions/beecrowd/1084/1084.py
Original file line number Diff line number Diff line change
@@ -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)
Empty file added solutions/beecrowd/1084/WRONG
Empty file.
Empty file.
15 changes: 15 additions & 0 deletions solutions/beecrowd/1084/in.txt
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions solutions/beecrowd/1084/out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
77676489625376239619
9822298
9551
99772345643212364555
99
121
1010001
31 changes: 31 additions & 0 deletions solutions/beecrowd/1084/problem.md
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions solutions/beecrowd/1084/tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
paradigms

0 comments on commit c4e9255

Please sign in to comment.