From ae326a706ff2578e40bd801b29e61cf9715194f6 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Thu, 2 Jun 2022 14:37:48 +0800 Subject: [PATCH] =?UTF-8?q?#2619.=20=E3=80=8CJSOI2008=E3=80=8D=E7=90=83?= =?UTF-8?q?=E5=BD=A2=E7=A9=BA=E9=97=B4=E4=BA=A7=E7=94=9F=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://loj.ac/s/1474445 --- LibreOJ/2619/2619.cpp | 56 ++++++++++++++++++++++++++++++++++++++++ LibreOJ/2619/data/1.in | 3 +++ LibreOJ/2619/data/1.out | 3 +++ LibreOJ/2619/data/10.in | 3 +++ LibreOJ/2619/data/10.out | 3 +++ LibreOJ/2619/data/2.in | 3 +++ LibreOJ/2619/data/2.out | 3 +++ LibreOJ/2619/data/3.in | 3 +++ LibreOJ/2619/data/3.out | 3 +++ LibreOJ/2619/data/4.in | 3 +++ LibreOJ/2619/data/4.out | 3 +++ LibreOJ/2619/data/5.in | 3 +++ LibreOJ/2619/data/5.out | 3 +++ LibreOJ/2619/data/6.in | 3 +++ LibreOJ/2619/data/6.out | 3 +++ LibreOJ/2619/data/7.in | 3 +++ LibreOJ/2619/data/7.out | 3 +++ LibreOJ/2619/data/8.in | 3 +++ LibreOJ/2619/data/8.out | 3 +++ LibreOJ/2619/data/9.in | 3 +++ LibreOJ/2619/data/9.out | 3 +++ 21 files changed, 116 insertions(+) create mode 100644 LibreOJ/2619/2619.cpp create mode 100644 LibreOJ/2619/data/1.in create mode 100644 LibreOJ/2619/data/1.out create mode 100644 LibreOJ/2619/data/10.in create mode 100644 LibreOJ/2619/data/10.out create mode 100644 LibreOJ/2619/data/2.in create mode 100644 LibreOJ/2619/data/2.out create mode 100644 LibreOJ/2619/data/3.in create mode 100644 LibreOJ/2619/data/3.out create mode 100644 LibreOJ/2619/data/4.in create mode 100644 LibreOJ/2619/data/4.out create mode 100644 LibreOJ/2619/data/5.in create mode 100644 LibreOJ/2619/data/5.out create mode 100644 LibreOJ/2619/data/6.in create mode 100644 LibreOJ/2619/data/6.out create mode 100644 LibreOJ/2619/data/7.in create mode 100644 LibreOJ/2619/data/7.out create mode 100644 LibreOJ/2619/data/8.in create mode 100644 LibreOJ/2619/data/8.out create mode 100644 LibreOJ/2619/data/9.in create mode 100644 LibreOJ/2619/data/9.out diff --git a/LibreOJ/2619/2619.cpp b/LibreOJ/2619/2619.cpp new file mode 100644 index 00000000..250a84f0 --- /dev/null +++ b/LibreOJ/2619/2619.cpp @@ -0,0 +1,56 @@ +#include +#include +#include +#include + +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; +} diff --git a/LibreOJ/2619/data/1.in b/LibreOJ/2619/data/1.in new file mode 100644 index 00000000..f132f159 --- /dev/null +++ b/LibreOJ/2619/data/1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c53ba6094cfd785934796e254e7f8400b4e0ed4e43e29bd35bd26ddbe0787799 +size 873 diff --git a/LibreOJ/2619/data/1.out b/LibreOJ/2619/data/1.out new file mode 100644 index 00000000..5a4d5534 --- /dev/null +++ b/LibreOJ/2619/data/1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:924429656bc1740ff62163370da307d7086ab6ac3b95fa6b8e08a5b81f3269e8 +size 72 diff --git a/LibreOJ/2619/data/10.in b/LibreOJ/2619/data/10.in new file mode 100644 index 00000000..d97e12b1 --- /dev/null +++ b/LibreOJ/2619/data/10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ee851f500ee2d6e7acb3a7a501be8f7621ed3e996abb67e5c1120bd4fe389bc5 +size 153 diff --git a/LibreOJ/2619/data/10.out b/LibreOJ/2619/data/10.out new file mode 100644 index 00000000..793f66a2 --- /dev/null +++ b/LibreOJ/2619/data/10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:160a9f56925575bdb5a07241001a49bb28290195a238f71e0bb75dd421d3cd45 +size 26 diff --git a/LibreOJ/2619/data/2.in b/LibreOJ/2619/data/2.in new file mode 100644 index 00000000..47dc19cf --- /dev/null +++ b/LibreOJ/2619/data/2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd00cf388f73e3197337819aefd62921278541b06889880fdff0c74dea2a93c6 +size 75 diff --git a/LibreOJ/2619/data/2.out b/LibreOJ/2619/data/2.out new file mode 100644 index 00000000..f14fc66d --- /dev/null +++ b/LibreOJ/2619/data/2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f61d07e7b41c85ef5abc61b172fa6d3daeba6ae5bd3769eeba26f8853b31e9e3 +size 18 diff --git a/LibreOJ/2619/data/3.in b/LibreOJ/2619/data/3.in new file mode 100644 index 00000000..3e930ae7 --- /dev/null +++ b/LibreOJ/2619/data/3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:485ac72cdadd13babed1a9587f0053ae9672257e1a71a6ad54356c1dffe9db92 +size 364 diff --git a/LibreOJ/2619/data/3.out b/LibreOJ/2619/data/3.out new file mode 100644 index 00000000..7e3a6f80 --- /dev/null +++ b/LibreOJ/2619/data/3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:24fd6555dc3e537eb49685696f98358466d02aeb988f6529dc6da72f965dd37e +size 45 diff --git a/LibreOJ/2619/data/4.in b/LibreOJ/2619/data/4.in new file mode 100644 index 00000000..03a7b032 --- /dev/null +++ b/LibreOJ/2619/data/4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7e9126b88041c6340625230aaafd7c33a66d91bc3570ead9474c109f4d9544e0 +size 1086 diff --git a/LibreOJ/2619/data/4.out b/LibreOJ/2619/data/4.out new file mode 100644 index 00000000..e9beca06 --- /dev/null +++ b/LibreOJ/2619/data/4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:127453f050ca3d902ec15b444e6619136c3aac20170a2ab319c4a65a548ce78d +size 80 diff --git a/LibreOJ/2619/data/5.in b/LibreOJ/2619/data/5.in new file mode 100644 index 00000000..9c2f18ae --- /dev/null +++ b/LibreOJ/2619/data/5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11b27e3f7841acb13585610d3f357d90bc22ba5e515302b11350c8b66efa528e +size 149 diff --git a/LibreOJ/2619/data/5.out b/LibreOJ/2619/data/5.out new file mode 100644 index 00000000..f952f9fb --- /dev/null +++ b/LibreOJ/2619/data/5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:efe293289dbf0eb1845a7761536dea5b63ce1c60898c39a104db0fd3ca12fbea +size 26 diff --git a/LibreOJ/2619/data/6.in b/LibreOJ/2619/data/6.in new file mode 100644 index 00000000..8b18e774 --- /dev/null +++ b/LibreOJ/2619/data/6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:003ed8d17358524dbfe43ec44318418503e0c0ddabf62f43325c8eeaee641967 +size 675 diff --git a/LibreOJ/2619/data/6.out b/LibreOJ/2619/data/6.out new file mode 100644 index 00000000..141e91df --- /dev/null +++ b/LibreOJ/2619/data/6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48b0a63b2c4e1e5bd0ef646ed9c7bd0599f13686b3a329037e328736283daf5a +size 62 diff --git a/LibreOJ/2619/data/7.in b/LibreOJ/2619/data/7.in new file mode 100644 index 00000000..3009da06 --- /dev/null +++ b/LibreOJ/2619/data/7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56bed36f4a01d6d44a9b0860694ab1ecdc3aca9dcd7ef97e5130c72903fe919e +size 146 diff --git a/LibreOJ/2619/data/7.out b/LibreOJ/2619/data/7.out new file mode 100644 index 00000000..699b7f69 --- /dev/null +++ b/LibreOJ/2619/data/7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2ad922c580f389fa83fe05b282a68e56344974fb212deb5df9d369105a5ff81 +size 27 diff --git a/LibreOJ/2619/data/8.in b/LibreOJ/2619/data/8.in new file mode 100644 index 00000000..a69dde40 --- /dev/null +++ b/LibreOJ/2619/data/8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f07c286c7b95727d44629ae8ebba255ebd40b0d460ef48ac088e29b8abb9348d +size 509 diff --git a/LibreOJ/2619/data/8.out b/LibreOJ/2619/data/8.out new file mode 100644 index 00000000..ed417e6a --- /dev/null +++ b/LibreOJ/2619/data/8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ab13cd864c0d69cedbe35ca6aa95c2631eb6b34aa2e6a422b479983406666541 +size 54 diff --git a/LibreOJ/2619/data/9.in b/LibreOJ/2619/data/9.in new file mode 100644 index 00000000..90c0cd29 --- /dev/null +++ b/LibreOJ/2619/data/9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5aed9aaaddc1c797711f388218ebe1b4aba88aa8e577ac29321476b9faee513c +size 1332 diff --git a/LibreOJ/2619/data/9.out b/LibreOJ/2619/data/9.out new file mode 100644 index 00000000..a2328762 --- /dev/null +++ b/LibreOJ/2619/data/9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:956a7dc55f2e4707ccbd84ef5ee2d0f700bb12ae73920eefd42fbd624d148157 +size 90