Предмет: Информатика, автор: ssdf01832

СРОЧНО ПИТОН!!!!!!!!!

За успеваемость!

В некотором классе a двоечников, b троечников, c хорошистов и d отличников (0⩽a,b,c,d⩽1000). Завуч определяет общую успеваемость класса по формуле a⋅2+b⋅3+c⋅4+d⋅5. Например, если a=2, b=5, c=9 и d=0, то успеваемость класса составит 2⋅2+5⋅3+9⋅4+0⋅5=4+15+36=55.


Классный руководитель по опыту знает, что если за одну парту посадить двух человек с разной успеваемостью (например, x и y), то через год их успеваемость сравняется до значения ⌈x+y2⌉ (x+y пополам, округленное вверх до целой части). Например, если посадить рядом двоечника и троечника, то через год двоечник станет троечником, а троечник так и останется троечником. А если посадить рядом двоечника и отличника, то через год они оба станут хорошистами.


Помогите классному руководителю рассчитать максимальную успеваемость своего класса через год, если рассадить ребят по-новому.


Формат входных данных

Первая строка входных данных содержит четыре неотрицательных целых числа, записанных через пробел: a, b, c и d. Гарантируется четность суммы этих чисел. Считайте, что лишних парт в классе нет.


Формат выходных данных

Выведите одно натуральное число — максимальную возможную успеваемость класса через год.


Система оценки и описание подзадач

Баллы за каждый тест начисляются независимо.


Пояснение к примеру

В примере в классе один двоечник, два троечника, три хорошиста и четыре отличника. Текущая успеваемость равна 1⋅2+2⋅3+3⋅4+4⋅5=2+6+12+20=40. Учитель посадит за первую парту двоечника и отличника, за вторую и третью — троечника и хорошиста, за четвертую — хорошиста и отличника, за пятую — двух отличников. Через год за первой, второй и третьей партами будут сидеть по два хорошиста, за остальными — отличники. Итоговая успеваемость станет равна 6⋅4+4⋅5=24+20=44.

Ответы

Автор ответа: WonderfulPENDEL
0

Ответ:

two,tree,four,five=map(int, input().split())

a = min(five,four)

five -= a

four -= a

b = min(four,tree)

tree -= b

four -= b

c = min(tree,two)

tree -= c

two -= c

d = min(two,five)

five -= d

two -= d

m = ((a * 5 + b * 4 + c * 3 + d * 4) * 2) + (two * 2) + (tree * 3) + (four * 4) + (five * 5)

print(m)

Объяснение:

Приложения:
Похожие вопросы
Предмет: Английский язык, автор: kostya118
Сделать 10 вопросов к тексту.

The Deadliest Place on Earth?
It's 50°C and has a humidity of 100%, less than a hundred people have been inside and it's so deadly that even with respirators and suits of ice you can only survive for 20 minutes before your body starts to fail. It's the nearest thing to visiting another planet - it's going deep inside our own! While making documentaries, I have been lucky enough to film everywhere from tiny Pacific islands to the centre of the i Sahara Desert, yet nowhere could prepare me for filming in The Giant Crystal Cave - Cueva de los Cristales of Mexico.
My director and I arrived in the quiet town of Naica as the morning sun painted the Chihuahuan Desert gold. It was a moment of calm that didn't last along. Within minutes we were going downwards inside the mine. The air became dusty, thick and heavy as sweat poured out of my skin - deeper and deeper we went.
1,000 feet down, we arrived at the control room where conditions were already an exhausting 45°C and 55% humidity. Here we met Gonzalo Infante of Speleoresearch & Films, who for more than five years has tirelessly worked to share the wonders of Naica with the world and to preserve them for future generations. It is his experience, and a 15-man team, that kept us alive as we filmed this geological wonder.
"You think this is hot" said Gonzalo pointing towards an iron door. "This is just a cool breeze compared to what you will feel like in there ... ready to go?". At this point I had expected to step into a bright orange ice-suit and put on a huge respirator backpack. Everyone else was dressed like astronauts preparing to go on a spacewalk, but Gonzalo insisted that our first visit should be a completely natural experience. He wanted us to physically and mentally prepare, just in case we ended up spending much longer inside than we had expected ... anxiously we pulled open the door and entered.
My glasses steamed up and their metal frames almost burnt me. I had to leave them at the entrance. Sweat poured from my head, my energy was sucked away, and my breathing became heavy. My eyes led me forwards, but my body wanted to go back. I was standing among a forest of giant gypsum crystals as sharp as blades - the largest crystals ever discovered, some up to 12 metres long (about the height of 6 men!) and as heavy as 55 tonnes.
The view was incredible; everything around us glittered, as though we were standing inside a star. However, within just five minutes I had gone from a fit 30-year-old to an unfit 60-year-old. As the air became hotter i only hoped that i would survive to tell the tale. This was going to be the most challenging shoot of my life.
For over half a million years these crystals have been slowly growing out of hot hydrothermal fluids rich with minerals. Undisturbed, one can only guess how big they may have eventually grown. Yet when mining began here over a hundred years ago, the cave was drained and the development of the crystals froze forever. It wasn't until 2001 that miners, searching for lead, eventually discovere it. This began the slow decay of the crystals and now no one knows what their fate will be.
Once the mine stops operating, it could be flooded by polluted mine water and abandoned forever. And that's if mineral sellers don't get to them first and rip them out to sell around the world, which has already happened to other smaller crystal caves in the area. My hope is that Gonzalo will succeed in finding funding to preserve this site as a World Heritage Monument. To me it is a wonderful example of the hidden forces of our planet. Who knows what other wonders lie hidden deep inside the Earth?