Софтуерно Инженерство
Loading...
valkata1220 avatar valkata1220 20 Точки

Проблем с 05.Dict.Ref-Advance от Nested Dictionaries Exercises

Задачата ми дава 60/100 и не мога да намеря проблема . Това е решението ми !

Remember the Dict-Ref Problem from the previous exercise? Well this one is an Advanced Version.
You will begin receiving input lines containing information in one of the following formats:
  - {key} -> {value 1, value 2, …, value n}
  - {key} -> {otherKey}

The keys will always be strings, and the values will always be integers, separated by a comma and a space. 
If you are given a key and values, you must store the values to the given key. If the key already exists, you must add the given values to the old ones.
If you are given a key and another key, you must copy the values of the other key to the first one. If the other key does not exist, this input line must be IGNORED.
When you receive the command “end”, you must stop reading input lines, and you must print all keys with their values, in the following format:
  - {key} === {value1, value2, value3. . .}

Input Output
Isacc -> 5, 4, 3
Peter -> 6, 3, 3
Derek -> 2, 2, 2
end
Isacc === 5, 4, 3
Peter === 6, 3, 3
Derek === 2, 2, 2
Donald -> 2, 2, 2
Isacc -> 1
George -> John
John -> Isacc
end
Donald === 2, 2, 2
Isacc === 1
John === 1

 

valkata1220 avatar valkata1220 20 Точки

Намерих си грешката -  в случай , че получа име и трябва да взема неговите числа аз присвояваявах списъка му с равно. Замених равното с AddRange и всичко заспа !

0
Georgi_Stoimenov avatar Georgi_Stoimenov 0 Точки

При мен също дава 60/100. Пробвах всякакви извратени входни данни, но не откривам проблема. Ето решението:  https://pastebin.com/6B2vX7gq

0
14/07/2017 22:43:41