Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45caedbfa7
|
@@ -1,11 +1,10 @@
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
int p = 0;
|
||||
int m = 0, n = 0;
|
||||
double A[5][10000], Z[10000];
|
||||
double A[5][10000] = {0}, Z[10000] = {0};
|
||||
|
||||
double get_content(int row, int column) {
|
||||
if (abs(row - column) > p / 2) {
|
||||
if (row - column > 2 || row - column < -2) {
|
||||
return 0;
|
||||
}
|
||||
if (row < 0 || row >= n) {
|
||||
@@ -14,11 +13,11 @@ double get_content(int row, int column) {
|
||||
if (column < 0 || column >= n) {
|
||||
return 0;
|
||||
}
|
||||
return A[(row - column + p / 2)][column];
|
||||
return A[(row - column + 2)][column];
|
||||
}
|
||||
|
||||
int set_content(int row, int column, double val) {
|
||||
if (abs(row - column) > p / 2) {
|
||||
if (row - column > 2 || row - column < -2) {
|
||||
return 0;
|
||||
}
|
||||
if (row < 0 || row >= n) {
|
||||
@@ -27,7 +26,7 @@ int set_content(int row, int column, double val) {
|
||||
if (column < 0 || column >= n) {
|
||||
return 0;
|
||||
}
|
||||
A[(row - column + p / 2)][column] = val;
|
||||
A[(row - column + 2)][column] = val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -53,13 +52,23 @@ int outputZ() {
|
||||
int main() {
|
||||
scanf("%d", &p);
|
||||
scanf("%d %d", &n, &m);
|
||||
for (int i = 0; i < p / 2; i++) {
|
||||
for (int j = p / 2 - i; j < n; j++) {
|
||||
// for (int i = 0; i < p / 2; i++) {
|
||||
// for (int j = p / 2 - i; j < n; j++) {
|
||||
// scanf("%lf", &A[i][j]);
|
||||
// }
|
||||
// }
|
||||
// for (int i = p / 2; i < p; i++) {
|
||||
// for (int j = 0; j < n - (i - p / 2); j++) {
|
||||
// scanf("%lf", &A[i][j]);
|
||||
// }
|
||||
// }
|
||||
for (int i = 2 - p / 2; i <= 2; i++) {
|
||||
for (int j = 2 - i; j < n; j++) {
|
||||
scanf("%lf", &A[i][j]);
|
||||
}
|
||||
}
|
||||
for (int i = p / 2; i < p; i++) {
|
||||
for (int j = 0; j < n - (i - p / 2); j++) {
|
||||
for (int i = 3; i <= 2 + p / 2; i++) {
|
||||
for (int j = 0; j < n - (i - 2); j++) {
|
||||
scanf("%lf", &A[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user