2 Commits
07_01 ... 07_02

Author SHA1 Message Date
unlockable
21ee0141ac AC. 2023-12-12 00:31:40 +08:00
unlockable
23114b575a 为什么少了一个tle?? 2023-12-11 23:54:45 +08:00

View File

@@ -31,20 +31,20 @@ int set_content(int row, int column, double val) {
return 0; return 0;
} }
int output() { // int output() {
for (int i = 0; i < p; i++) { // for (int i = 0; i < p; i++) {
for (int j = 0; j < n; j++) { // for (int j = 0; j < n; j++) {
printf("%lf ", get_content(i, j)); // printf("%lf ", get_content(i, j));
} // }
printf("\n"); // printf("\n");
} // }
printf("\n"); // printf("\n");
return 0; // return 0;
} // }
int outputZ() { int outputZ() {
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
printf("%lf ", Z[i]); printf("%.4lf ", Z[i]);
} }
printf("\n"); printf("\n");
return 0; return 0;
@@ -75,7 +75,7 @@ int main() {
if (base != 0) { if (base != 0) {
double coefficient = base / diag_elem; double coefficient = base / diag_elem;
set_content(row, col, -coefficient); set_content(row, col, -coefficient);
for (int l = col + 1; l < n; l++) { for (int l = col + 1; l < col + 3; l++) {
set_content(row, l, get_content(row, l) - coefficient * get_content(col, l)); set_content(row, l, get_content(row, l) - coefficient * get_content(col, l));
} }
} }
@@ -140,10 +140,11 @@ int main() {
// outputZ(); // outputZ();
// output // output
for (int j = 0; j < n; j++) { // for (int j = 0; j < n; j++) {
printf("%.4lf ", Z[j]); // printf("%.4lf ", Z[j]);
} // }
printf("\n"); // printf("\n");
outputZ();
} }
return 0; return 0;
} }