mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-27 14:16:28 +00:00
parent
4eede84a3f
commit
ae326a706f
56
LibreOJ/2619/2619.cpp
Normal file
56
LibreOJ/2619/2619.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <iomanip>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 15;
|
||||
const double eps = 1e-6;
|
||||
|
||||
int n;
|
||||
double a[N][N], b[N][N];
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
|
||||
cin >> n;
|
||||
|
||||
for (int i = 1; i <= n + 1; i++) {
|
||||
for (int j = 1; j <= n; j++) {
|
||||
cin >> a[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
for (int j = 1; j <= n; j++) {
|
||||
b[i][j] = 2.0 * (a[i][j] - a[i + 1][j]);
|
||||
b[i][n + 1] += std::pow(a[i][j], 2) - std::pow(a[i + 1][j], 2);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
for (int j = i; j <= n; j++) {
|
||||
if (std::abs(b[j][i]) > eps) {
|
||||
std::swap(b[i], b[j]);
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 1; j <= n; j++) {
|
||||
if (i == j) continue;
|
||||
double x = b[j][i] / b[i][i];
|
||||
for (int k = i; k <= n + 1; k++) {
|
||||
b[j][k] -= b[i][k] * x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cout << std::fixed << std::setprecision(3) << b[i][n + 1] / b[i][i] << ' ';
|
||||
}
|
||||
cout << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
LibreOJ/2619/data/1.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/1.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/10.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/10.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/2.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/2.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/3.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/3.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/4.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/4.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/5.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/5.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/6.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/6.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/7.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/7.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/8.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/8.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/9.in
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
LibreOJ/2619/data/9.out
(Stored with Git LFS)
Normal file
BIN
LibreOJ/2619/data/9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user