-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0097f90
commit 6fbee9a
Showing
4 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|
||
} |