odświeżam sobie analityczne myslenie przed rozmowa o prace i robie zadanka na hackerranku i nie moge dojsc dlaczego moje rozwiazanie za nic nie chce przejsc.
Given a square matrix, calculate the absolute difference between the sums of its diagonals.
Sample Input 3 11 2 4 4 5 6 10 8 -12
to moja funkcja, nie mam zielonego pojecia dlaczego to nie chce przejsc testow
The first line contains a single integer, , the number of rows and columns in the square matrix . Each of the next lines describes a row, , and consists of space-separated integers . Dlatego biore arr[0][0] jako wielkosc macierzy
@rzulw: zrobilem taka liste lokalnie w visual studio i pieknie wypluwa rozwiazanie w konsolowej apce, szukalem na internecie i jak sie okazlao moje rozwiazanie jest bardziej optymalne bo korzysta z jednej petli. Tylko jakims cudem nie przechodzi testow
@zibizz1: i kur... przechodzi tylko jeden test gdzie jest macierz wypelniona jedynkami, a lokalnie w visual studio dziala. Dlaczego, nie mam pojecia XD
@napalonykrzysztof: ano w takim razie wyglada sensownie, przesuniecie o 1 ma teraz sens, nie czytalem az tak dokladnie inputu tylko od razu kodzik ( ͡°͜ʖ͡°)
@rzulw: @zibizz1: cytat z dyskusji w zadaniu ktora dopiero teraz zauwazylem ze moge czytac przed wyslaniem: Hey, my buddy, I was struggling with the same error, and finally, I figured it out, the array for C++/C# does not contain the first line, that is, we have to get the matrix size from the number of elements of arr.
Wszystko jasne, dziękuje koliegowie. Życzcie mi 8k w przyszlym tygodniu XD
Given a square matrix, calculate the absolute difference between the sums of its diagonals.
Sample Input
3
11 2 4
4 5 6
10 8 -12
to moja funkcja, nie mam zielonego pojecia dlaczego to nie chce przejsc testow
#csharp #programowanie
int n = arr[0][0]; -> int n = arr.Count(); # czy jak tam robicie to w tym jezyku towarzyszu
# potem w forze oba
arr[i + 1] -> arr[i]
The first line contains a single integer, , the number of rows and columns in the square matrix .
Each of the next lines describes a row, , and consists of space-separated integers .
Dlatego biore arr[0][0] jako wielkosc macierzy
Hey, my buddy, I was struggling with the same error, and finally, I figured it out, the array for C++/C# does not contain the first line, that is, we have to get the matrix size from the number of elements of arr.
Wszystko jasne, dziękuje koliegowie. Życzcie mi 8k w przyszlym tygodniu XD
@napalonykrzysztof: no i dostałeś tą pracę?
na czym sie wylozyles?