5. Tseam account
Колеги нужна ми е малко помощ с тази задача https://pastebin.com/wE5qpbqC в ми дава 90/100, което много ме изкарва извън нерви. Моля да споделите опита си какво правите като видите, че само един от тестовете ви гърми, има ли значение кой е, как се ориентирате къде може да ви е грешката, ползвате ли някакви екстеншъни, който да ви помагат и прочее. нейното условие :
1. Tseam Account
As a gamer, Peter has Tseam Account. He loves to buy new games. You are given Peter's account with all of his games-> strings, separated by space. Until you receive "Play!" you will be receiving commands which Peter does with his account.`
You may receive the following commands:
- Install {game}
- Uninstall {game}
- Update {game}
- Expansion {game}-{expansion}
If you receive Install command, you should add the game at last position in the account, but only if it isn't installed already.
If you receive Uninstall command, delete the game if it exists.
If you receive Update command, you should update the game if it exists and place it on last position.
If you receive Expansion command, you should check if the game exists and insert after it the expansion in the following format: "{game}:{expansion}";
Input
- On the first input line you will receive Peter`s account - sequence of game names, separated by space.
- Until you receive "Play!" you will be receiving commands.
Output
- As output you must print Peter`s Tseam account.
Constraints
- The command will always be valid.
- The game and expansion will be strings and will contain any character, except '-'.
- Allowed working time / memory: 100ms / 16MB.
Examples
Input |
Output |
Comments |
['CS WoW Diablo', 'Install LoL', 'Uninstall WoW', 'Update Diablo', 'Expansion CS-Go', 'Play!'] |
CS CS:Go LoL Diablo |
We receive the account => CS, WoW, Diablo We Install LoL => CS, WoW, Diablo, LoL Uninstall WoW => CS, Diablo, LoL Update Diablo => CS, LoL, Diablo We add expansion => CS, CS:Go, LoL, Diablo We print the account. |
['CS WoW Diablo', 'Uninstall XCOM', 'Update PeshoGame', 'Update WoW', 'Expansion Civ-V', 'Play!'] |
CS Diablo WoW |
|
т.е. пропуснал си условието: "If you receive Install command, you should add the game at last position in the account, but only if it isn't installed already."
Благодаря, а Вие лично как разбирате кои са частните случаи?
Обикновено това са основните разклонения в логиката на задачата, но теорията не е силната ми страна и едва ли го формулирам добре. Истината е, че с опита нещата се избистрят и интуицията ти ще ги открива по-лесно... "решете 1000 задачи, и неусетно ще сте придобили солиден опит"... :)