-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask5.c
More file actions
30 lines (27 loc) · 809 Bytes
/
task5.c
File metadata and controls
30 lines (27 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2024 <Tudorica Radu Andrei>
#include "helper.h"
void column(int **a, int row, int the_col) {
int aux = a[row - 1][the_col];
for (int i = row - 1; i > 0; i--) {
a[i][the_col] = a[i - 1][the_col];
}
a[0][the_col] = aux;
}
int task5(int **a, int row, int col) {
int max_score = 0, score = 0;
for (int i = 0; i < col - 1; i++) {
for (int j = i + 1 ; j < col; j++) {
for (int k = 0; k < row; k++) {
for (int l = 0; l < row; l++) {
score = task2(a, col);
if (score > max_score) {
max_score = score;
}
column(a, row, j);
}
column(a, row, i);
}
}
}
return max_score;
}