diff --git a/LibreOJ/3564/3564.cpp b/LibreOJ/3564/3564.cpp new file mode 100644 index 00000000..fc0cf36e --- /dev/null +++ b/LibreOJ/3564/3564.cpp @@ -0,0 +1,59 @@ +#include +#include +#include + +std::ifstream cin("number.in"); +std::ofstream cout("number.out"); +const char endl = '\n'; + +int t, x, ans[200005]; +bool f[10000005]; +std::pair q[200005]; + +bool has7(int x) { + while (x) { + if (x % 10 == 7) return true; + x /= 10; + } + + return false; +} + +int main() { + cin >> t; + + for (int i = 7; i <= 10000000; i += 7) { + f[i] = true; + } + + for (int i = 1; i <= 10000000; i++) { + if (has7(i)) { + for (int j = 1; i * j <= 10000000; j++) { + f[i * j] = true; + } + } + } + + for (int i = 0; i < t; i++) { + cin >> q[i].first; + q[i].second = i; + } + + std::sort(q, q + t); + + for (int i = 0, j = 1; i < t; i++) { + if (f[q[i].first]) { + ans[q[i].second] = -1; + continue; + } + while (j <= q[i].first) j++; + while (j <= 10000000 && f[j]) j++; + ans[q[i].second] = j; + } + + for (int i = 0; i < t; i++) { + cout << ans[i] << endl; + } + + return 0; +} diff --git a/LibreOJ/3564/data/number1.ans b/LibreOJ/3564/data/number1.ans new file mode 100644 index 00000000..4c5918d3 --- /dev/null +++ b/LibreOJ/3564/data/number1.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e724a7345b6829976d6e831a1a86dae494798e4eae2c5014ad052d6d0904ff2 +size 29 diff --git a/LibreOJ/3564/data/number1.in b/LibreOJ/3564/data/number1.in new file mode 100644 index 00000000..523cfd13 --- /dev/null +++ b/LibreOJ/3564/data/number1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fdca0243d057afc211dd8c13273032f92826b26d609a7fbea1ca9ac037a9d7d3 +size 31 diff --git a/LibreOJ/3564/data/number10.ans b/LibreOJ/3564/data/number10.ans new file mode 100644 index 00000000..f76dfff2 --- /dev/null +++ b/LibreOJ/3564/data/number10.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81ac33d60780200ae6409256be6aef9fe22caf34b9b4b96ef57b6db7c69c12b3 +size 1350218 diff --git a/LibreOJ/3564/data/number10.in b/LibreOJ/3564/data/number10.in new file mode 100644 index 00000000..e338e552 --- /dev/null +++ b/LibreOJ/3564/data/number10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:09c66990bd061c513d24ae155559eaac3904f0c47ba1ad5516ad89ceb937578d +size 1576858 diff --git a/LibreOJ/3564/data/number2.ans b/LibreOJ/3564/data/number2.ans new file mode 100644 index 00000000..2bc9141e --- /dev/null +++ b/LibreOJ/3564/data/number2.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5a2bc0c697d85f7e7b0e3e21d2b499fa40c418290aa14effb0a35ecce9fcb60 +size 375 diff --git a/LibreOJ/3564/data/number2.in b/LibreOJ/3564/data/number2.in new file mode 100644 index 00000000..8494e9c4 --- /dev/null +++ b/LibreOJ/3564/data/number2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6cccd909a5b6cf42e44d3033b125df991da25ee0c975cac5f9bcca244c73c2a0 +size 392 diff --git a/LibreOJ/3564/data/number3.ans b/LibreOJ/3564/data/number3.ans new file mode 100644 index 00000000..2fa5fb17 --- /dev/null +++ b/LibreOJ/3564/data/number3.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7c142c76a4293f010d1ee585beec8240dfe2e9f0cc955f8535e0df598f6f89f +size 376 diff --git a/LibreOJ/3564/data/number3.in b/LibreOJ/3564/data/number3.in new file mode 100644 index 00000000..95acd51b --- /dev/null +++ b/LibreOJ/3564/data/number3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0a0fb468cb20d37b851e37b788b2e62d633679250a3aae27b11355723168d44 +size 397 diff --git a/LibreOJ/3564/data/number4.ans b/LibreOJ/3564/data/number4.ans new file mode 100644 index 00000000..0890193c --- /dev/null +++ b/LibreOJ/3564/data/number4.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97df412f3749a39d024d42cac5ab990a35e9c81a9671152a2192dca2bb83b020 +size 4469 diff --git a/LibreOJ/3564/data/number4.in b/LibreOJ/3564/data/number4.in new file mode 100644 index 00000000..92fc34cb --- /dev/null +++ b/LibreOJ/3564/data/number4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a9defc9586dacc0cdf5e5cddc7f6776517b0f69d6be603089aa32554b60dcc88 +size 4870 diff --git a/LibreOJ/3564/data/number5.ans b/LibreOJ/3564/data/number5.ans new file mode 100644 index 00000000..bbc02806 --- /dev/null +++ b/LibreOJ/3564/data/number5.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9abdf1b07bc26087598725739f9e4361d8606ba3839c2eabe476e991625f633 +size 4539 diff --git a/LibreOJ/3564/data/number5.in b/LibreOJ/3564/data/number5.in new file mode 100644 index 00000000..c194718f --- /dev/null +++ b/LibreOJ/3564/data/number5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e83dec97bfff891203b8b531da9c1f530eeedfa94d41cb2137f21e33c8c072f0 +size 4877 diff --git a/LibreOJ/3564/data/number6.ans b/LibreOJ/3564/data/number6.ans new file mode 100644 index 00000000..abf57153 --- /dev/null +++ b/LibreOJ/3564/data/number6.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d2aada97861c049a5468ba619a746fee98380643c065d557700b89e97c7ffd5 +size 57209 diff --git a/LibreOJ/3564/data/number6.in b/LibreOJ/3564/data/number6.in new file mode 100644 index 00000000..b768aa4c --- /dev/null +++ b/LibreOJ/3564/data/number6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:52d6e690fdff3bc7e20574cb367fd7a52b89ea4b154d8ef7f723ddcd50cc2e6e +size 64609 diff --git a/LibreOJ/3564/data/number7.ans b/LibreOJ/3564/data/number7.ans new file mode 100644 index 00000000..8d9d9bd8 --- /dev/null +++ b/LibreOJ/3564/data/number7.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:814f3bdca00b26ff90d32486a9fdbbf841a965d29d7a95313631b674465ba619 +size 57217 diff --git a/LibreOJ/3564/data/number7.in b/LibreOJ/3564/data/number7.in new file mode 100644 index 00000000..63c07259 --- /dev/null +++ b/LibreOJ/3564/data/number7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5d7a2df1b83076f8f23905d4608e718b60b14adedc56613caa73d5caa95232bf +size 64639 diff --git a/LibreOJ/3564/data/number8.ans b/LibreOJ/3564/data/number8.ans new file mode 100644 index 00000000..ed8917c1 --- /dev/null +++ b/LibreOJ/3564/data/number8.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d2bf7d7d4be82f5ea19c132914a49f9917852ae2d50dc874e4a80e8397a57d91 +size 1350716 diff --git a/LibreOJ/3564/data/number8.in b/LibreOJ/3564/data/number8.in new file mode 100644 index 00000000..ec4fcd56 --- /dev/null +++ b/LibreOJ/3564/data/number8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a9899a7354194f78c3bdc8fa175623a9f6963e2c46088d8cb552a32d45fa747c +size 1576813 diff --git a/LibreOJ/3564/data/number9.ans b/LibreOJ/3564/data/number9.ans new file mode 100644 index 00000000..d232327b --- /dev/null +++ b/LibreOJ/3564/data/number9.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1debb383c10f1864a23f9b6ed3f411d1e68ac5019518d99f6c435b328c5f7cb7 +size 1349076 diff --git a/LibreOJ/3564/data/number9.in b/LibreOJ/3564/data/number9.in new file mode 100644 index 00000000..80535686 --- /dev/null +++ b/LibreOJ/3564/data/number9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:acdc6bb676a654a770c700007a7e44a338a911eb0dc48dc0c07b8afe4c270b7f +size 1576703