Loading...
V3lin avatar V3lin 1 Точки

Fireworks Show

Здравейте,

 

Опитвам се да реша следната задача:

First, you will be given a sequence of integers representing firework effects. Afterwards you will be given another sequence of integers representing explosive power.

You need to start from the first firework effect and try to mix it with the last explosive power. If the sum of their values is:

  1. divisible by 3, but it is not divisible by 5 create Palm firework and remove both materials
  2. divisible by 5, but it is not divisible by 3 create Willow firework and remove both materials
  3. divisible by both 3 and 5 create Crossette firework and remove both materials

Otherwise, decrease the value of the firework effect by 1 and move it at the end of the sequence. Then, try to mix the same explosive power with the next firework effect.

If any value is equal to or below 0, you should remove it from the sequence before trying to mix it with the other.

When you have successfully prepared enough fireworks for the show or you have no more firework punches or explosive power, you need to stop mixing.

To make the perfect firework show, Maria needs 3 of each of the firework types.

Input

  1. On the first line, you will receive the integers representing the firework effects, separated by ", ".
  2. On the second line, you will receive the integers representing the explosive power, separated by ", ".

Output

  1. On the first line, print:
    • if Maria successfully prepared the firework show: "Congrats! You made the perfect firework show!"
    • if Maria failed to prepare it: "Sorry. You can't make the perfect firework show."
  2. On the second line, print all firework effects left if there are any:
  • Firework Effects left: {effect1}, {effect2}, (…)"
  1. On the third line, print all explosive fillings left if there are any:
  •  Explosive Power left: {filling1}, {filling2}, (…)"
  1. , you need to print all fireworks and the amount you have of them:
    • "Palm Fireworks: {count}"
    • "Willow Fireworks: {count}"
    • "Crossette Fireworks: {count}"

Constraints

  1. All the given numbers will be integers in the range [-100, 100].
  2. There will be no cases with empty sequences.

Examples

Input

Output

5, 6, 4, 16, 11, 5, 30, 2, 3, 27

1, 13, 5, 3, -7, 32, 19, 3, 5, 7, 22

Congrats! You made the perfect firework show!

Palm Fireworks: 4

Willow Fireworks: 3

Crossette Fireworks: 3

Comment

1) 5 + 22 = 27 is devisible by 3 -> Palm Firework. Remove both.

2) 6 + 7 = 13 -> can't create firework. Firework effect should be decreased with 1 -> 5 and moved at the end

3) 4 + 7= 11 -> can't create firework. Firework effect should be decreased with 1 -> 3 and moved at the end

3) 16 + 7 = 23 -> can't create firework. Firework effect should be decreased with 1 -> 15 and moved at the end

4) 11 + 7 = 18 is devisible by 3 -> Palm Firework. Remove both.

5) 5 + 5 = 10 is devisible by 5 -> Willow Firework. Remove both.

6) 30 + 3 = 33 is devisible by 3 -> Palm Firework. Remove both.

7) 2 + 19 = 21 is devisible by 3 -> Palm Firework. Remove both.

8) 3 + 32 = 35 is devisible by 5 -> Willow Firework. Remove both.

9) (-7) is negative, so we remove it before mixing.

10) 27 + 3 = 30 is devisible by 5 and 3 -> Crossette Firework. Remove both.

11) 5 + 5 = 10 is devisible by 5 -> Willow Firework. Remove both.

12) 3 + 13 = 16 -> can't create firework. Firework effect should be decreased with 1 -> 2 and moved at the end

13) 15 + 13 = 28 -> can't create firework. Firework effect should be decreased with 1 -> 14 and moved at the end

14) 2 + 13 = 15 is devisible by 5 and 3 -> Crossette Firework. Remove both.

15) 1 + 14 = 15 is devisible by 5 and 3 -> Crossette Firework. Remove both.

We have enough fireworks to make a firework show.

 

Input

Output

-15, -8, 0, -16, 0, -22

10, 5

Sorry. You can't make the perfect firework show.

Explosive Power left: 10, 5

Palm Fireworks: 0

Willow Fireworks: 0

Crossette Fireworks: 0

Comment

After removing all the invalid integers, the firework effects's sequence is empty and the program ends.

Judge ми дава 60/100. Знам, че задачата я има решена вече, но ме интересува къде е грешката в моя код и начин на решаване на задачата. Предположението ми е, че нещо се омазва когато попвам и апендвам.

Pastebin: https://pastebin.com/kX8Ax5iN

Благодаря предварително.

Тагове:
0
Python Advanced
icowwww avatar icowwww 2803 Точки
Best Answer

Здравей,

Винаги копирай текста директно от условието на задачата:

Firework Effects left: {effect1}, {effect2}, (…)"

При теб е без s на ред 46 и ред 59: 

print(f'Firework Effect left: {", ".join(str(s) for s in fireworks_effects)}')

https://pastebin.com/E1JZ6c50

0
V3lin avatar V3lin 1 Точки

Здравей,

Много глупава грешка... :/ Благодаря за помощта.

 

0
florencepugh avatar florencepugh 1 Точки

Great job on the firework show program in C++! Your attention to detail and creativity shone through in the program's execution. The way you captured the contexto bursts of color and motion was truly impressive. Well done!

-1
bekean avatar bekean -2 Точки

I'm glad you liked the fnf firework show program in C++. Many thanks for sharing!

0
emmausa avatar emmausa -5 Точки

I really like the information you share. I learned a lot of new and useful knowledge from your post. capybara clicker

-1
adamusa avatar adamusa 2 Точки

This method is very cool and I think it can be applied to many other fields. mapquest directions

-1
sneezefreeze avatar sneezefreeze 4 Точки

That C++ code for the fireworks display is fantastic. Your originality and focus on detail were clearly evident in the final product of the program. The data geometry dash lite you present is excellent. New and helpful information was imparted to me.

0
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.