QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#327017 | #2505. 报数 | iee | 100 ✓ | 192ms | 52072kb | C++11 | 767b | 2024-02-14 17:48:12 | 2024-02-14 17:48:13 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
constexpr int N = 1e7 + 55;
bool v[N], ans[N];
int nxt[N];
int main() {
cin.tie(0)->sync_with_stdio(0);
for (int i = 1; i < N; ++i) {
int cur = i;
while (cur) {
if (cur % 10 == 7) {
v[i] = 1;
break;
}
cur /= 10;
}
}
for (int i = 1; i < N; i++) {
if (!v[i]) continue;
if (ans[i]) continue;
for (int j = i; j < N; j += i) {
ans[j] = 1;
}
}
int las = -1;
for (int i = N - 1; i >= 0; i--) {
if (!ans[i]) {
nxt[i] = las;
las = i;
}
}
int t;
cin >> t;
while (t--) {
int x;
cin >> x;
if (ans[x]) cout << -1 << "\n";
else cout << nxt[x] << "\n";
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 10
Accepted
time: 152ms
memory: 51976kb
input:
10 99 94 6 69 44 95 36 3 96 26
output:
100 -1 8 80 45 96 38 4 99 29
result:
ok 10 lines
Test #2:
score: 10
Accepted
time: 140ms
memory: 51976kb
input:
100 515 251 48 687 208 206 62 843 768 521 569 1000 866 363 269 318 98 185 120 309 866 995 33 128 869 83 269 488 559 69 739 16 838 400 155 393 544 699 904 590 1 883 465 990 484 996 495 545 824 110 662 968 369 416 996 69 369 815 492 249 1000 410 451 521 421 333 859 99 366 593 859 49 906 968 398 509 83...
output:
520 253 50 -1 209 208 64 844 -1 523 580 1004 881 366 281 319 -1 -1 121 310 881 996 36 129 -1 86 281 489 562 80 -1 18 839 401 159 396 -1 800 905 593 2 886 466 991 488 998 496 549 829 113 664 982 382 418 998 80 382 818 495 250 1004 412 452 523 422 -1 862 100 368 596 862 -1 909 982 400 512 -1 -1 183 86...
result:
ok 100 lines
Test #3:
score: 10
Accepted
time: 146ms
memory: 51972kb
input:
100 125 933 123 45 813 641 265 998 190 699 660 669 993 699 159 842 200 844 965 800 236 593 656 854 113 339 52 684 258 356 683 569 97 839 397 272 118 898 342 421 569 565 968 464 4 284 206 449 549 775 824 960 864 999 353 190 431 249 285 106 269 915 169 1000 704 466 412 618 466 667 613 95 685 269 492 2...
output:
128 939 124 46 -1 643 269 1000 191 800 661 682 995 800 160 843 202 845 968 802 239 596 659 -1 115 341 53 -1 260 -1 689 580 -1 841 -1 -1 120 899 -1 422 580 566 982 465 5 -1 208 451 551 -1 829 961 -1 -1 359 191 433 250 -1 109 281 916 180 1004 -1 480 415 619 480 -1 615 96 -1 281 495 253 382 995 605 110...
result:
ok 100 lines
Test #4:
score: 10
Accepted
time: 152ms
memory: 52052kb
input:
1000 8138 3218 1699 1884 240 2186 9663 5699 699 80 3098 4013 4100 6999 7706 2082 5019 1458 6695 2518 2665 9645 4513 6639 699 9098 3984 6430 965 6924 3455 1044 5699 9465 3992 5620 9699 3065 9829 8549 6353 2648 5662 1777 2659 2359 44 6321 6949 5341 5233 2296 4351 9623 9108 8320 269 2699 1543 2663 4666...
output:
8149 3221 1801 -1 241 2189 9664 5801 800 82 3099 4016 4105 8000 -1 -1 -1 -1 6803 2519 2666 9649 4516 6640 800 9103 3986 6431 968 -1 3459 -1 5801 9481 3993 5623 9803 3083 9830 8553 6359 2649 5665 -1 2662 -1 45 -1 6959 -1 5239 -1 4353 9624 -1 8324 281 2801 1545 2665 4681 3529 169 6803 6803 5693 800 22...
result:
ok 1000 lines
Test #5:
score: 10
Accepted
time: 159ms
memory: 52064kb
input:
1000 4695 813 1804 2699 3449 2760 3329 821 3698 3183 8159 3751 6726 655 5497 7148 991 9403 1699 5534 601 4219 9613 9364 3631 6125 9699 5069 6343 9993 9115 1266 4695 2699 9691 9811 1823 6809 3301 9699 9245 6656 5320 9969 4846 2323 4916 7485 4626 654 6695 8233 2438 2046 9699 1082 5218 1703 8049 6463 4...
output:
4801 -1 1805 2801 3453 -1 3331 823 3802 3189 8161 -1 -1 656 -1 -1 992 9413 1801 -1 604 4220 9615 9382 3636 -1 9803 -1 6353 9995 9119 1280 4801 2801 9692 9812 1826 6821 3305 9803 9249 6658 -1 9980 4848 2326 4918 -1 -1 -1 6803 8240 2440 2048 9803 1086 5224 -1 8053 6464 4083 2882 -1 5290 1893 9421 9840...
result:
ok 1000 lines
Test #6:
score: 10
Accepted
time: 146ms
memory: 52072kb
input:
10000 98918 155173 80871 112442 142565 53272 30248 86693 118061 126339 56839 56999 116996 160989 109090 132893 131519 139683 171024 130699 109693 55691 43613 56999 2433 156767 56999 199998 106993 199997 154699 56151 792 9832 58699 104509 191195 81509 65581 148021 215 194413 116771 72725 39058 125591...
output:
98921 -1 -1 112444 142589 -1 -1 86803 118081 126341 56843 58010 118004 160991 109103 132896 131525 139801 -1 130805 109805 55801 43618 58010 2438 -1 58010 -1 108002 -1 154811 -1 -1 9833 58802 104513 191206 81533 65589 148045 218 194431 -1 -1 39059 125593 152809 -1 14411 130805 58010 141383 -1 3643 1...
result:
ok 10000 lines
Test #7:
score: 10
Accepted
time: 157ms
memory: 51940kb
input:
10000 140689 40000 142144 115569 180409 66995 165077 186118 169996 166990 186986 36999 116996 42311 166990 161059 165964 169996 106993 85469 125261 186986 3803 141827 106993 196220 132019 56999 64319 149260 56999 56230 21220 193861 98398 134245 32129 84104 198851 165050 135597 25630 38661 104369 132...
output:
140803 40006 -1 115589 180410 68002 -1 186119 180001 168005 188009 38002 118004 42319 168005 161060 165983 180001 108002 85489 125266 188009 3809 -1 108002 196239 132024 58010 64321 -1 58010 56233 21221 193862 98402 134255 32138 84109 198859 165052 -1 25633 -1 104381 132424 111122 -1 31295 4604 2806...
result:
ok 10000 lines
Test #8:
score: 10
Accepted
time: 192ms
memory: 52072kb
input:
200000 5214541 5015321 6999998 6836424 8699993 2425889 1486642 8880099 4436998 7183846 638063 1861859 129296 3648297 3699996 4848143 3005068 2006990 7830940 6135683 6999998 5699996 4156863 2424869 3640593 9926999 6802599 5206991 3493430 8369996 1504803 322426 4436998 2100664 699999 6204262 8644593 4...
output:
5214593 5015345 8000000 -1 8800009 2425910 -1 8880101 4438009 -1 638081 1861861 129299 -1 3800003 4848163 -1 2008001 -1 6135839 8000000 5800010 4156883 -1 3640603 9928010 -1 5208010 -1 8380018 1504805 322429 4438009 2100683 800000 6204281 8644609 -1 -1 -1 6800002 5946349 8145133 2800001 5386492 2683...
result:
ok 200000 lines
Test #9:
score: 10
Accepted
time: 179ms
memory: 52052kb
input:
200000 8493539 9561661 8256998 8794527 8622424 4380469 9754348 6602039 9030699 9513331 9699999 8112338 3474747 3193165 5498663 301845 6869969 4824167 9456999 2699999 9679874 5395853 2316809 3623065 8056991 9436993 9169999 2616998 1403461 9730574 8669998 5043293 6154669 325191 1680919 8993419 5389523...
output:
8493559 9561683 8258000 -1 -1 4380483 -1 6602042 9030802 9513359 9800002 8112386 -1 3193186 5498693 301849 6880009 -1 9458003 2800001 -1 5395883 2316815 -1 8058002 9438001 9180001 2618003 1403489 -1 8680003 5043295 6154819 -1 1680920 8993443 5389529 5692982 -1 -1 4331899 -1 906481 488003 1238959 592...
result:
ok 200000 lines
Test #10:
score: 10
Accepted
time: 180ms
memory: 51984kb
input:
200000 9335161 4029741 2221565 9969998 6625459 39155 6945559 1495429 9969998 8088893 7104654 9699999 5856026 3696653 6816639 8645898 5930299 2069999 6517110 603066 4651050 200926 6100189 1593149 9234366 613213 1213330 1665249 665800 4456996 6673323 8965826 6025179 1935049 7754565 4665430 6119021 159...
output:
9335189 -1 2221589 9980006 6625481 -1 6945581 -1 9980006 8088898 -1 9800002 5856029 3696656 -1 8645899 5930303 2080000 -1 603082 -1 200929 6100196 1593181 -1 613218 1213332 1665250 665801 4458001 -1 8965829 -1 1935069 -1 -1 6119030 1592893 9848008 302213 8280001 -1 4010438 5480003 9844382 1899382 88...
result:
ok 200000 lines
Extra Test:
score: 0
Extra Test Passed