From 28175399cb48339222953751876a8755fcac36fe Mon Sep 17 00:00:00 2001 From: DarkSharpness_XzY <2040703891@qq.com> Date: Fri, 20 Oct 2023 22:07:15 +0800 Subject: [PATCH] =?UTF-8?q?Upd:=20=E5=8A=A0=E5=85=A5=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E9=9D=9E=E5=B8=B8=E6=AF=92=E7=98=A4=E7=9A=84=20corner?= =?UTF-8?q?=20case=20=E6=B5=8B=E8=AF=95=E7=82=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/Integer3/1.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ data/Integer3/1.out | 4 ++++ data/Integer3/2.cpp | 30 ++++++++++++++++++++++++++++++ data/Integer3/2.out | 2 ++ data/Integer3/3.cpp | 26 ++++++++++++++++++++++++++ data/Integer3/3.out | 3 +++ 6 files changed, 107 insertions(+) create mode 100644 data/Integer3/1.cpp create mode 100644 data/Integer3/1.out create mode 100644 data/Integer3/2.cpp create mode 100644 data/Integer3/2.out create mode 100644 data/Integer3/3.cpp create mode 100644 data/Integer3/3.out diff --git a/data/Integer3/1.cpp b/data/Integer3/1.cpp new file mode 100644 index 0000000..e82ccec --- /dev/null +++ b/data/Integer3/1.cpp @@ -0,0 +1,42 @@ +/* +Time: 2023-10-20 +Test: Custom constructor. Div and mod. +std Time: 0.30s +Time Limit: 1.00s +Notes: Sanity check. +*/ + +#include "int2048.h" + +void sanity_check(sjtu::int2048 &x,sjtu::int2048 &y) { + // Sanity check of division + std::cout + << x / y << ' ' + << -x / y << ' ' + << x / -y << ' ' + << -x / -y << '\n'; + + // Sanity check of mod + std::cout + << x % y << ' ' + << -x % y << ' ' + << x % -y << ' ' + << -x % -y << '\n'; +} + +signed main() { + // sanity check + sjtu::int2048 x {"0000000000001145141919810"}; + // normal test + sjtu::int2048 y {"-1145141919810"}; + + y += 1; + sanity_check(x, y); + + y += -2; + y -= -1; + + sanity_check(x, y); + + return 0; +} diff --git a/data/Integer3/1.out b/data/Integer3/1.out new file mode 100644 index 0000000..4cd9771 --- /dev/null +++ b/data/Integer3/1.out @@ -0,0 +1,4 @@ +-2 1 1 -2 +-1145141919808 -1 1 1145141919808 +-1 1 1 -1 +0 0 0 0 \ No newline at end of file diff --git a/data/Integer3/2.cpp b/data/Integer3/2.cpp new file mode 100644 index 0000000..2a2034f --- /dev/null +++ b/data/Integer3/2.cpp @@ -0,0 +1,30 @@ +/* +Time: 2023-10-20 +Test: Custom constructor. Div and mod. +std Time: 0.30s +Time Limit: 1.00s +Notes: Sanity check. +*/ + +#include "int2048.h" + +void sanity_check(sjtu::int2048 &x) { + (0 / x).print(); std::cout << ' '; + (1 / x).print(); std::cout << ' '; + (-1 / x).print();std::cout << ' '; + + (0 % x).print(); std::cout << ' '; + (1 % x).print(); std::cout << ' '; + (-1 % x).print();std::cout << '\n'; +} + +signed main() { + sjtu::int2048 x; + + x.read("-1919810"); + sanity_check(x); + + x = -x; + sanity_check(x); + return 0; +} diff --git a/data/Integer3/2.out b/data/Integer3/2.out new file mode 100644 index 0000000..1764dec --- /dev/null +++ b/data/Integer3/2.out @@ -0,0 +1,2 @@ +0 -1 0 0 -1919809 -1 +0 0 -1 0 1 1919809 diff --git a/data/Integer3/3.cpp b/data/Integer3/3.cpp new file mode 100644 index 0000000..232d56f --- /dev/null +++ b/data/Integer3/3.cpp @@ -0,0 +1,26 @@ +/* +Time: 2023-10-20 +Test: Copy constructor and assignment operator. +std Time: 0.30s +Time Limit: 1.00s +Notes: Sanity check. +*/ + +#include "int2048.h" + +void sanity_check(sjtu::int2048 &x) { + x = x = x = x = x = x = x = x = x; + sjtu::int2048 y = (((((((((((((x))))))))))))); + sjtu::int2048 z = (((((((-(((((x)))))))))))); + x = ( x = (x = (x = y + z + x))); +} + +signed main() { + sjtu::int2048 x {"111111111111111111111111111111111111111111111111111111111111111111111111112"}; + sanity_check(x); + std::cout << x << '\n'; + std::cout << -sjtu::int2048{0} << '\n'; + x.read("-0"); + std::cout << x << '\n'; + return 0; +} diff --git a/data/Integer3/3.out b/data/Integer3/3.out new file mode 100644 index 0000000..fa65454 --- /dev/null +++ b/data/Integer3/3.out @@ -0,0 +1,3 @@ +111111111111111111111111111111111111111111111111111111111111111111111111112 +0 +0