QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#414568#2505. 报数x-camp70 119ms42744kbC++171022b2024-05-19 09:48:252024-05-19 09:48:26

Judging History

你现在查看的是最新测评结果

  • [2024-05-19 09:48:26]
  • 评测
  • 测评结果:70
  • 用时:119ms
  • 内存:42744kb
  • [2024-05-19 09:48:25]
  • 提交

answer

#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
#include <set>
#include <cstring>
#define MX 10000002
using namespace std;
int a[MX];
int N;
bool hasSeven(int n) {
    while (n > 0) {
        if( (n % 10) == 7) {
            return true;
        }
        n /= 10;
    }
    return false;
}
int main() {
    cin >> N;
    for (int i=7; i < MX;i++) {
        if (i == 5214547) {
            int x = 0;
        }
        if (a[i] > 0) continue;
        if (hasSeven(i)) {
            a[i] = 1;
            for (int j=1; j<MX/i; j++) {
                    a[j*i] = 1;
            }
        }
    }
    for (int i=0; i<N; i++) {
        int k;
        cin >> k;
        if (a[k] == 1)
            cout << -1 << endl;
        else {
            for (int m=k+1; m < MX; m++) {
                if (a[m] == 0) {
                    cout << m << endl;
                    break;
                }
            }
        }
    }
 
    return 0;
}





Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 10
Accepted
time: 113ms
memory: 42600kb

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: 96ms
memory: 42736kb

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: 119ms
memory: 42740kb

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: 91ms
memory: 42672kb

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: 101ms
memory: 42744kb

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: 101ms
memory: 42720kb

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: 97ms
memory: 42592kb

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: 0
Time Limit Exceeded

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
8699996
2425910
-1
8880101
4438009
-1
638081
1861861
129299
-1
3800003
4848163
-1
2008001
-1
6135839
8000000
5800010
4156883
-1
3640603
9928010
-1
5208010
-1
8380011
1504805
322429
4438009
2100683
800000
6204281
8644609
-1
-1
-1
6800002
5946349
8145118
2800001
5386492
2683...

result:


Test #9:

score: 0
Time Limit Exceeded

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:

8493542
9561663
8258000
-1
-1
4380483
-1
6602042
9030802
9513332
9800002
8112345
-1
3193186
5498693
301849
6880009
-1
9458003
2800001
-1
5395883
2316815
-1
8058002
9436999
9180001
2618003
1403489
-1
8680003
5043295
6154819
-1
1680920
8993421
5389529
5692982
-1
-1
4331899
-1
906481
488003
1238959
592...

result:


Test #10:

score: 0
Time Limit Exceeded

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:

9335162
-1
2221589
9969999
6625481
-1
6945581
-1
9969999
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
9846992
302213
8280001
-1
4010438
5480003
9844365
1899382
88...

result: