diff --git a/S2OJ/1663/1663.cpp b/S2OJ/1663/1663.cpp new file mode 100644 index 00000000..773fb59e --- /dev/null +++ b/S2OJ/1663/1663.cpp @@ -0,0 +1,68 @@ +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 1e5 + 5; +const int mod = 998244853; + +int t, n, p[N], p1[N]; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + p1[0] = 1; + for (int i = 1; i <= 100000; i++) { + p[i] = (static_cast(p[i - 1]) * 10 % mod + 8) % mod; + p1[i] = static_cast(p1[i - 1]) * 10 % mod; + } + + cin >> t; + + while (t--) { + cin >> n; + + int l = std::ceil(1.0 * n / 7); + + if (n == 1) { + cout << -1 << endl; + } else if (n == 2) { + cout << 1 << endl; + } else if (n == 3) { + cout << 7 << endl; + } else if (n == 4) { + cout << 4 << endl; + } else if (n == 5) { + cout << 2 << endl; + } else if (n == 6) { + cout << 0 << endl; + } else if (n == 7) { + cout << 8 << endl; + } else if (n == 8) { + cout << 10 << endl; + } else if (n == 9) { + cout << 18 << endl; + } else if (n == 10) { + cout << 22 << endl; + } else if (n % 7 == 0) { + cout << p[l] << endl; + } else if (n % 7 == 1) { + cout << (static_cast(l - 2 > 0 ? p[l - 2] : 0) + static_cast(p1[l - 1])) % mod << endl; + } else if (n % 7 == 2) { + cout << (static_cast(l - 1 > 0 ? p[l - 1] : 0) + static_cast(p1[l - 1])) % mod << endl; + } else if (n % 7 == 3) { + cout << (static_cast(l - 3 > 0 ? p[l - 3] : 0) + static_cast(p1[l - 1]) * 2 % mod) % mod << endl; + } else if (n % 7 == 4) { + cout << (static_cast(l - 2 > 0 ? p[l - 2] : 0) + static_cast(p1[l - 1]) * 2 % mod) % mod << endl; + } else if (n % 7 == 5) { + cout << (static_cast(l - 1 > 0 ? p[l - 1] : 0) + static_cast(p1[l - 1]) * 2 % mod) % mod << endl; + } else { // n % 7 == 6 + cout << (static_cast(l - 1 > 0 ? p[l - 1] : 0) + static_cast(p1[l - 1]) * 6 % mod) % mod << endl; + } + } + + return 0; +} diff --git a/S2OJ/1663/data/problem.conf b/S2OJ/1663/data/problem.conf new file mode 100644 index 00000000..9cd086f3 --- /dev/null +++ b/S2OJ/1663/data/problem.conf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2b27015b2b335bbdae6daf8a81fe0354e2c7186f33baad742dc3a4905fda34a +size 179 diff --git a/S2OJ/1663/data/stick1.ans b/S2OJ/1663/data/stick1.ans new file mode 100644 index 00000000..e26d2bc2 --- /dev/null +++ b/S2OJ/1663/data/stick1.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d453b228963a265e112a78c39d48ca8cc08ed0763a0f33b9c03a73f2a71c68d0 +size 23 diff --git a/S2OJ/1663/data/stick1.in b/S2OJ/1663/data/stick1.in new file mode 100644 index 00000000..57dbd22b --- /dev/null +++ b/S2OJ/1663/data/stick1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2a71877388b6bf00defcf061972f6ef52f869cfe26a20ff92c6aef827d15374 +size 24 diff --git a/S2OJ/1663/data/stick10.ans b/S2OJ/1663/data/stick10.ans new file mode 100644 index 00000000..1a273d28 --- /dev/null +++ b/S2OJ/1663/data/stick10.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b661830bfb8d8cfe44a09f1d46c798ee8a2b803914bf2c2eafb00ffed8158c8 +size 988645 diff --git a/S2OJ/1663/data/stick10.in b/S2OJ/1663/data/stick10.in new file mode 100644 index 00000000..fa46eeb2 --- /dev/null +++ b/S2OJ/1663/data/stick10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e5c34bba7b0ad73421faf18da7a43565ece7572144db3ebf13826de221598ca +size 589027 diff --git a/S2OJ/1663/data/stick2.ans b/S2OJ/1663/data/stick2.ans new file mode 100644 index 00000000..3c403406 --- /dev/null +++ b/S2OJ/1663/data/stick2.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97acb37319e0c5a3ac8b0e4090faf9648e29bb1010dc90157f4df9ffd895a6aa +size 39 diff --git a/S2OJ/1663/data/stick2.in b/S2OJ/1663/data/stick2.in new file mode 100644 index 00000000..28b5cdda --- /dev/null +++ b/S2OJ/1663/data/stick2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eac18357fc647ec378412321fe17d1173d7821d80ba6803c505e21dab59e49f4 +size 39 diff --git a/S2OJ/1663/data/stick3.ans b/S2OJ/1663/data/stick3.ans new file mode 100644 index 00000000..51cfb562 --- /dev/null +++ b/S2OJ/1663/data/stick3.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b0529abea4c2960a68c5201fded2ac8d1c80724dbb0590824b1f6037c38ee3f +size 36 diff --git a/S2OJ/1663/data/stick3.in b/S2OJ/1663/data/stick3.in new file mode 100644 index 00000000..86c2818a --- /dev/null +++ b/S2OJ/1663/data/stick3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:647580b3af962c64b19a3ef96d553bc1b72e1cd2495a4811e93b504ac672fbca +size 33 diff --git a/S2OJ/1663/data/stick4.ans b/S2OJ/1663/data/stick4.ans new file mode 100644 index 00000000..2823ab19 --- /dev/null +++ b/S2OJ/1663/data/stick4.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:962fa4fe4846334d96c167b05cc818c248e8e3b994ba146bba4d207a31497121 +size 289 diff --git a/S2OJ/1663/data/stick4.in b/S2OJ/1663/data/stick4.in new file mode 100644 index 00000000..45a39941 --- /dev/null +++ b/S2OJ/1663/data/stick4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11b9863804394ae300897053360a2279ca915883fa2dc62aa8aa849b7529125f +size 123 diff --git a/S2OJ/1663/data/stick5.ans b/S2OJ/1663/data/stick5.ans new file mode 100644 index 00000000..ac63d0cf --- /dev/null +++ b/S2OJ/1663/data/stick5.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ddc5130d47c0074459b7018cee7e7fa47e1d6e23369c864d48cbd0fb2650a437 +size 348 diff --git a/S2OJ/1663/data/stick5.in b/S2OJ/1663/data/stick5.in new file mode 100644 index 00000000..477d2354 --- /dev/null +++ b/S2OJ/1663/data/stick5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07296105c01fcdbee724c5abf4c7cdca5bdfe45a1d6ca19fa5bbcb93474cf4fe +size 174 diff --git a/S2OJ/1663/data/stick6.ans b/S2OJ/1663/data/stick6.ans new file mode 100644 index 00000000..0838e198 --- /dev/null +++ b/S2OJ/1663/data/stick6.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:32a06e657fe4a780c29786705db52bf4b3ba8a1644727f0a10a88879f4b1ed22 +size 70 diff --git a/S2OJ/1663/data/stick6.in b/S2OJ/1663/data/stick6.in new file mode 100644 index 00000000..cae520fc --- /dev/null +++ b/S2OJ/1663/data/stick6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2eb44d9f41c803583a7e6904496760ac7556b754dbbec534d47bdeb1b82073f6 +size 44 diff --git a/S2OJ/1663/data/stick7.ans b/S2OJ/1663/data/stick7.ans new file mode 100644 index 00000000..0927b19e --- /dev/null +++ b/S2OJ/1663/data/stick7.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:042fd021646d64919cad3e5f4ea105aaac562d36073fc74b329c3169d46bbdfa +size 79899 diff --git a/S2OJ/1663/data/stick7.in b/S2OJ/1663/data/stick7.in new file mode 100644 index 00000000..3898af10 --- /dev/null +++ b/S2OJ/1663/data/stick7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1123dbda8f7cdf64fb29c74774bf7e3d3d84651b812d1f3785b2051d94c3b17a +size 31888 diff --git a/S2OJ/1663/data/stick8.ans b/S2OJ/1663/data/stick8.ans new file mode 100644 index 00000000..cb969ba2 --- /dev/null +++ b/S2OJ/1663/data/stick8.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:988ee02ea22a0fbdc18e26f40ae31187d80ade70ebf5630bd77a24ed4c526e5a +size 988721 diff --git a/S2OJ/1663/data/stick8.in b/S2OJ/1663/data/stick8.in new file mode 100644 index 00000000..4cc37722 --- /dev/null +++ b/S2OJ/1663/data/stick8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ffdc07ac8e9a597ed41728d37cace1ecc2ebda2b30b92563b7ad5be26725c58 +size 589127 diff --git a/S2OJ/1663/data/stick9.ans b/S2OJ/1663/data/stick9.ans new file mode 100644 index 00000000..ee1ec68b --- /dev/null +++ b/S2OJ/1663/data/stick9.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d22249c999d51a54ee6215a19a60b5807f43c5129d6d324294a666fac02d938a +size 988462 diff --git a/S2OJ/1663/data/stick9.in b/S2OJ/1663/data/stick9.in new file mode 100644 index 00000000..0ad0b685 --- /dev/null +++ b/S2OJ/1663/data/stick9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f04a3383750a8a1657e0fe8e61a7a00346ec30cc889e9949d778b2ff14be100a +size 589007