Skip to content

Commit

Permalink
add partial solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
witek-formanski committed Jan 9, 2024
1 parent 0097f90 commit 6fbee9a
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
Binary file added other/dijkstra.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added src/cw9/zad5/path.cpp
Empty file.
10 changes: 10 additions & 0 deletions src/cw9/zad9/islands.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
mamy dwie kolejki - na wodę i na ląd
dodajemy wodny padding dookoła tablicy
zaczynamy w narożniku i odwiedzamy całą wodę
gdy kolejka wodna jest pusta, dodajemy do wyniku 1
i przestawiamy się na kolejkę lądową
wtedy odwiedzamy cały ląd
gdy kolejka lądowa jest pusta przerzucamy się na wodę
i tak dalej
*/
45 changes: 45 additions & 0 deletions src/kol3_13/mice_in_the_corridor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include <algorithm>
#include <iostream>
#include <cmath>

int** get_sum(int mice[], int n) {
int** sum = new int*[n];
for (int i = 0; i < n; i++)
sum[i] = new int[n]{0};

for (int i = 0; i < n; i++)
sum[i][i] = mice[i];

for (int length = 2; length < n; length++) {
for (int i = 0; i < n - length; i++) {
sum[i][i + length - 1] = sum[i][i+ length - 2] + mice[i + length - 1] - pow(length - 1, 2);
}
}

return sum;
}

int** get_max_in_interval(int** sum, int n) {

}


void print(int** tab, int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++)
std::cout << tab[i][j] << "\t";
std::cout << "\n";
}
}


int mice_in_the_corridor(int mice[], int n) {

}

int main() {
// print()
int* mice = new int[8]{1, 5, 1, 4, 3, 2, 7, 0};
print(get_sum(mice, 8), 8);

}

0 comments on commit 6fbee9a

Please sign in to comment.