Problem 3. Heart Delivery
https://pastebin.com/687FwXz4 - Някой идея къде мога да греша, всички примерни изходи работят, но в judge гърми 60/100
https://pastebin.com/687FwXz4 - Някой идея къде мога да греша, всички примерни изходи работят, но в judge гърми 60/100
Здравей, arnold,
Би ли дал и условието на задачата (поставено направо тук като текст) + линк към нея в Judge?
Hello Arnold,
The decision of my colleague Sveпхото is good.
Here we do not have unnecessary empty spaces and the code passes without the command to remove them.
Best!
https://judge.softuni.bg/Contests/Practice/Index/2031#2
Problem 3. Heart Delivery
Valentine’s Day is coming, and Cupid has very limited time to spread some love across the neighborhood. Help him with his mission!
You will receive a string with even integers, separated by a "@". This is our neighborhood. After that a series of Jump commands will follow, until you receive "Love!" Every house in the neighborhood needs a certain number of hearts delivered by Cupid, in order to be able to celebrate Valentine’s Day. Those needed hearts are indicated by the integers in the neighborhood.
Cupid starts at the position of the first house (index 0) and must jump by a given length. The jump commands will be in this format: "Jump {length}".
Every time he jumps from one house to another, the needed hearts for the visited house are decreased by 2. If the needed hearts for a certain house become equal to 0 , print on the console "Place {houseIndex} has Valentine's day." If Cupid jumps to a house where the needed hearts are already 0, print on the console "Place {houseIndex} already had Valentine's day.".
Keep in mind that Cupid can have a bigger jump length than the size of the neighborhood and if he does jump outside of it, he should start from the first house again.
For example, we are given this neighborhood: 6@6@6. Cupid is at the start and jumps with a length of 2. He will end up at index 2 and decrease the needed hearts there by 2: [6, 6, 4]. Next he jumps again with a length of 2 and goes outside the neighborhood, so he goes back to the first house (index 0) and again decreases the needed hearts there: [4, 6, 4].
Input
Output
At the end print Cupid's last position and whether his mission was successful or not:
Constraints
Examples
Input
Output
Comments
10@10@10@2
Jump 1
Jump 2
Love!
Place 3 has Valentine's day.
Cupid's last position was 3.
Cupid has failed 3 places.
Jump 1 ->> [10, 8, 10, 2]
Jump 2 ->> [10, 8, 10, 0] so we print "Place 3 has Valentine's day."
Next command is "Love!", so we print Cupid`s last position and the outcome of his mission.
2@4@2
Jump 2
Jump 2
Jump 8
Jump 3
Jump 1
Love!
Place 2 has Valentine's day.
Place 0 has Valentine's day.
Place 0 already had Valentine's day.
Place 0 already had Valentine's day.
Cupid's last position was 1.
Cupid has failed 1 places.
Леко я модифицирах, но мръдна от 60/100, на 70/100 и толкова, не иска повече :D
https://pastebin.com/rXCCuQm3
Браво за усилията, продължавай все така упорито борбата с кода
Виж аз как я модифицирах за 100/100, дано да ти бъде от полза: https://pastebin.com/iS9bV1KT.