Ex Pokemon Trainer from Class Definition ex.
Здравейте,
получавам 90/100 резултат на тази задача. Може ли за малко помощ, за да открия грешката си.
Благодаря предварително
https://judge.softuni.bg/Contests/Compete/Index/1518#5
-
Pokémon Trainer
You wanna be the very best pokemon trainer, like no one ever was, so you set out to catch pokemons. Define a class Trainer and a class Pokemon . Trainer has a name , a number of badges and a collection of pokemon . Pokemon has a name , an element and health , all values are mandatory . Every Trainer starts with 0 badges .
From the console you will receive an unknown number of lines until you receive the " Tournament " command , each line will carry information about a pokemon and the trainer who caught it in the format "< TrainerName> <PokemonName> <PokemonElement> <PokemonHealth> " where TrainerName is the name of the Trainer who caught the pokemon, the names are unique there are no 2 trainers with the same name. After receiving the " Tournament " command an unknown number of lines containing one of the three elements " Fire ", " Water ", " Electricity " will follow until the command ""is received. For every command you must check if a trainer has at least 1 pokemon with the given element, if he does he receives 1 badge, otherwise all his pokemon lose 10 health , if a pokemon falls to 0 or less health he dies After the command " End " is received you should print all the trainers sorted by the amount of badges they have in descending order (if two trainers have the same amount of badges they should be sorted by order of appearance in the input) in the format "< TrainerName> <Badges> <NumberOfPokemon ".
Examples
Input |
Output |
Pesho Charizard Fire 100 Gosho Squirtle Water 38 Pesho Pikachu Electricity 10 Tournament Fire Electricity End |
Pesho 2 2 Gosho 0 1 |
Stamat Blastoise Water 18 Nasko Pikachu Electricity 22 Jicata Kadabra Psychic 90 Tournament Fire Electricity Fire End |
Nasko 1 1 Stamat 0 0 Jicata 0 1 |
Pesho Pikachu Electricity 10 Tournament Electricity End |