[C# Advanced] Jedi Galaxy - Тест номер 2
Здравейте,
Решавам тази задача от подготовката за изпит и не успявам да хвана втроия тест. Може ли да дадете идеи, какво пропускам ?
Поздрави.
Здравейте,
Решавам тази задача от подготовката за изпит и не успявам да хвана втроия тест. Може ли да дадете идеи, какво пропускам ?
Поздрави.
Здравейте, тъй като вече има подобна тема ще пиша тук.
Прекарах сигурно един цял работен ден над тази задача, но получавам само 10/100. Може би не разбирам условието, което прочетох много на брой пъти. Въпреки всичко това с дадените инпути получавам посочените аутпути. Вече изчерпах всичките си идеи за тази задача и моля за помощ, тъй като не осъзнавам какво пропускам (освен, че не искам да имам в кода си допълнителни while цикли за валидирането на стартовете, а директно си ги задавам, тъй като while циклите може да се извъртят безброй много пъти до намирането на старта).
Ivo's galaxy is represented as a two-dimensional array. You will receive two integers, separated by a space, which represent the two dimensional array - the first being the rows and the second being the columns. Every cell in the matrix is a star that has a value. Ivo starts at the given row and col. He can move only on the diagonal from the lowest left to the upper right, and adds to his score all the stars (values) from the cells he passes through. Unfortunately, there is always an Evil power that tries to prevent his success.
Evil power starts at the given row and col and instantly destroys all stars on the opposite diagonal - from lowest right to the upper left. Ivo adds the values only of the stars that are not destroyed by the evil power.
Then, you must fill the two dimensional array with increasing integers starting from 0, and continuing on every row, like this:
first row: 0, 1, 2… m
second row: n+1, n+2, n+3… n + n.
The input ends when you receive the command "Let the Force be with you". When that happens, you must print the value of all stars that Ivo has collected successfully.
Input:
5 5
5 -1
5 5
Let the Force be with you
Output:
48
Input:
5 5
4 -1
4 5
Let the Force be with you
Output:
29
https://pastebin.com/Hmw6060y
Hi Eli,
Two variants of Jedi-Galaxy.
:-)
Hi,
Thanks for both solutions.
I saw a lot of solutions about this exercise, but I can't see where is the problem in mine. Why I got only 10 points? Is my logic incorrect and I don't understand the exercise? I was debugging and your solutions and it seems my solution should is working correctly, but is not.
All the best!
Heavy code.
Main problem came from index-validations executed at the following =>
Also, when modifying the matrix you need to validate the coordinates each time, which is why you received 10/100