Loading...

Във форума е въведено ограничение, което позволява на потребителите единствено да разглеждат публикуваните въпроси.

weedknight avatar weedknight 1 Точки

Message Manager - Python Fundamentals

Здравейте. Тъй като не успях да мина изпита поради ред причини, бих искал да попитам дали решението ми е вярно, тъй като не успрях въобще да го кача в джъдж, а и също така може да има нещо в него, което би дало насока или да помогне на някой друг.

Моето решение: https://pastebin.com/AJfYp2U2

ПС: тествах кода с примерните входове и всичко излиза точно, както се очаква, но не мога да бъда 100% сигурен.

 

Условие на задачата:

Messages Manager

Create a program that manages messages sent and received of users. You need to keep information about username, their sent and received messages. You will receive the capacity of possible messages kept at once per user. You will be receiving lines with commands until you receive the "Statistics" command.  There are three possible commands:

  • "Add={username}={sent}={received}":
    • Add the username, his/her sent and received messages to your recordsIf person with the given username already exists ignore the line.
  • "Message={sender}={receiver}":
    • Check if both usernames exist and if they doincrease the sender’s sent messages by 1 and the receiver’s received messages by 1. If anyone reaches the capacity (first check the sender), he/she should be removed from the record and you should print the following message:
      • "{username} reached the capacity!"
  • "Empty={username}":
    • Delete all records of the given userif he exists. If "All" is given as username - delete all records you have.

In the end, you have to print the count of users, each person with his/her messages (the count of both sent and received) sorted in descending order by the received messages and then by their username in ascending order in the following format:  

Users count: {count}

{username} - {messages}

{username} - {messages}

Input

  • On the first line, you will receive the capacity - an integer number in the range [1-10000].
  • You will be receiving lines until you receive the "Statistics" command.
  • The initial messages (sent and received) will always be below the capacity.
  • The input will always be valid.

Output

  • Print the appropriate message after the "Message" command, if someone reaches the capacity.
  • Print the users with their messages in the format described above.
0
Python Fundamentals
luciham20 avatar luciham20 5 Точки

Mitrasphere takes place in a planet where there are two ocean skies. One planet floats far above the other, with a massive abyss between them. On the planet above, there is a significant tree that bears golden crystal fruits that shower down to the world below. Those who are affected will have their lives forever changed. Some people are blessed with good fortune, while others are cursed with a lot of misery. "Mitra" is the name given to the fruit that yields both hope and tragedy. Your journey begins with you as an ordinary Plainsfolk achieving consciousness in Mitrasphere, a mythological world. As the hero of the doomed world below, discover the adventure that awaiting you.

More games at PlayPC.io

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