QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#414519#2919. SubprimeTheSleepyDevil#AC ✓67ms14572kbC++142.1kb2024-05-19 06:23:242024-05-19 06:23:24

Judging History

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

  • [2024-05-19 06:23:24]
  • 评测
  • 测评结果:AC
  • 用时:67ms
  • 内存:14572kb
  • [2024-05-19 06:23:24]
  • 提交

answer

    /*
     Hell, 'til I reach Hell, I ain't scared
     Mama checkin' in my bedroom, I ain't there
                                                */
    #include<bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    using namespace __gnu_pbds;
    using namespace std;

    #define Major  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #define TxtIO   freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    #define read(a,n) for(int i = 0 ; i<n ; i++) cin>>a[i];
    #define write(a) for(auto x : a) cout<<x<<" ";
    #define int long long
    #define pb push_back
    #define all(a)  a.begin(),a.end()
    #define el "\n"

    typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

    const int inf=4e18;

    int dx[]={1,0,-1,0,1,1,-1,-1};
    int dy[]={0,1,0,-1,1,-1,1,-1};

    const int mod=1e9+7;
    const int MAX =1e6+7;

   // ---------------------------Function----------------------------------//
     vector<bool> is_prime(1e7+1, true);
    void TestCake(){
        vector<int>tmp;
        for(int i=1;i<=1e7;i++){
            if(is_prime[i]){
                tmp.pb(i);
            }
        }
        int l,r;cin>>l>>r;
        string s;
        cin>>s;
        int cnt=0;
        for(int i=l-1;i<r;i++){
            string here=to_string(tmp[i]);
            if(here.find(s)!=string::npos){
                cnt++;
            }
        }
        cout<<cnt;
    }
    //------------------------------Main---------------------------//
    signed main(){
        Major
        int T = 1;

            is_prime[0] = is_prime[1] = false;
            for (int i = 2; i * i <= 1e7; i++) {
                if (is_prime[i]) {
                    for (int j = i * i; j <= 1e7; j += i)
                        is_prime[j] = false;
                }
            }
//        cin >> T;
        while(T--){
            TestCake();
        //       cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
        }
        return 0;
    }

详细

Test #1:

score: 100
Accepted
time: 59ms
memory: 13024kb

input:

1 10000
389

output:

45

result:

ok single line: '45'

Test #2:

score: 0
Accepted
time: 63ms
memory: 13628kb

input:

1 100
8

output:

8

result:

ok single line: '8'

Test #3:

score: 0
Accepted
time: 52ms
memory: 13844kb

input:

8000 9000
395

output:

0

result:

ok single line: '0'

Test #4:

score: 0
Accepted
time: 56ms
memory: 14572kb

input:

50000 80000
572

output:

63

result:

ok single line: '63'

Test #5:

score: 0
Accepted
time: 62ms
memory: 12900kb

input:

90000 100000
9999

output:

5

result:

ok single line: '5'

Test #6:

score: 0
Accepted
time: 62ms
memory: 14100kb

input:

1 100000
37502

output:

1

result:

ok single line: '1'

Test #7:

score: 0
Accepted
time: 59ms
memory: 12784kb

input:

1 1000
000

output:

0

result:

ok single line: '0'

Test #8:

score: 0
Accepted
time: 59ms
memory: 13672kb

input:

4509 12345
9999

output:

4

result:

ok single line: '4'

Test #9:

score: 0
Accepted
time: 61ms
memory: 13292kb

input:

1 1
2

output:

1

result:

ok single line: '1'

Test #10:

score: 0
Accepted
time: 51ms
memory: 13868kb

input:

2 8
2

output:

0

result:

ok single line: '0'

Test #11:

score: 0
Accepted
time: 51ms
memory: 12676kb

input:

2 9
2

output:

1

result:

ok single line: '1'

Test #12:

score: 0
Accepted
time: 58ms
memory: 14424kb

input:

1 100000
2

output:

44448

result:

ok single line: '44448'

Test #13:

score: 0
Accepted
time: 67ms
memory: 14132kb

input:

1 100000
0

output:

38298

result:

ok single line: '38298'

Test #14:

score: 0
Accepted
time: 57ms
memory: 13344kb

input:

1 100000
00

output:

3384

result:

ok single line: '3384'

Test #15:

score: 0
Accepted
time: 61ms
memory: 13520kb

input:

1 100000
000000

output:

0

result:

ok single line: '0'

Test #16:

score: 0
Accepted
time: 51ms
memory: 13152kb

input:

6 6
13

output:

1

result:

ok single line: '1'

Test #17:

score: 0
Accepted
time: 59ms
memory: 14432kb

input:

19 19
67

output:

1

result:

ok single line: '1'

Test #18:

score: 0
Accepted
time: 60ms
memory: 14144kb

input:

2137 2137
18719

output:

1

result:

ok single line: '1'

Test #19:

score: 0
Accepted
time: 65ms
memory: 13100kb

input:

1 100000
1

output:

65575

result:

ok single line: '65575'

Test #20:

score: 0
Accepted
time: 53ms
memory: 13124kb

input:

1 100000
9

output:

54268

result:

ok single line: '54268'

Test #21:

score: 0
Accepted
time: 66ms
memory: 13012kb

input:

12345 98765
0021

output:

40

result:

ok single line: '40'

Test #22:

score: 0
Accepted
time: 53ms
memory: 14208kb

input:

12345 98765
0201

output:

38

result:

ok single line: '38'

Test #23:

score: 0
Accepted
time: 65ms
memory: 14384kb

input:

12345 98765
2022

output:

21

result:

ok single line: '21'

Test #24:

score: 0
Accepted
time: 61ms
memory: 14340kb

input:

12345 98765
0222

output:

16

result:

ok single line: '16'

Test #25:

score: 0
Accepted
time: 57ms
memory: 13540kb

input:

1 100000
123456

output:

0

result:

ok single line: '0'

Test #26:

score: 0
Accepted
time: 61ms
memory: 12756kb

input:

1 100000
999937

output:

0

result:

ok single line: '0'

Test #27:

score: 0
Accepted
time: 62ms
memory: 13440kb

input:

1 100000
999953

output:

1

result:

ok single line: '1'

Test #28:

score: 0
Accepted
time: 57ms
memory: 14384kb

input:

1 100000
299709

output:

1

result:

ok single line: '1'

Test #29:

score: 0
Accepted
time: 64ms
memory: 13968kb

input:

1 99999
299709

output:

0

result:

ok single line: '0'

Test #30:

score: 0
Accepted
time: 65ms
memory: 14416kb

input:

50000 100000
611953

output:

1

result:

ok single line: '1'

Test #31:

score: 0
Accepted
time: 60ms
memory: 14420kb

input:

50001 100000
611953

output:

0

result:

ok single line: '0'

Test #32:

score: 0
Accepted
time: 65ms
memory: 13672kb

input:

1 100000
12345

output:

8

result:

ok single line: '8'

Test #33:

score: 0
Accepted
time: 66ms
memory: 13808kb

input:

1 100000
2053

output:

46

result:

ok single line: '46'

Test #34:

score: 0
Accepted
time: 60ms
memory: 12876kb

input:

3 5
3

output:

0

result:

ok single line: '0'

Test #35:

score: 0
Accepted
time: 63ms
memory: 12808kb

input:

2 6
3

output:

2

result:

ok single line: '2'

Test #36:

score: 0
Accepted
time: 63ms
memory: 13624kb

input:

1 669
4999

output:

1

result:

ok single line: '1'

Test #37:

score: 0
Accepted
time: 63ms
memory: 13804kb

input:

260 309
003

output:

1

result:

ok single line: '1'

Test #38:

score: 0
Accepted
time: 56ms
memory: 12760kb

input:

1110 1159
151

output:

1

result:

ok single line: '1'

Test #39:

score: 0
Accepted
time: 51ms
memory: 14276kb

input:

145 155
88

output:

3

result:

ok single line: '3'

Test #40:

score: 0
Accepted
time: 62ms
memory: 13176kb

input:

2 99999
0

output:

38297

result:

ok single line: '38297'

Test #41:

score: 0
Accepted
time: 61ms
memory: 14556kb

input:

1911 2000
111

output:

0

result:

ok single line: '0'

Test #42:

score: 0
Accepted
time: 63ms
memory: 12880kb

input:

99960 100000
9709

output:

1

result:

ok single line: '1'

Test #43:

score: 0
Accepted
time: 59ms
memory: 13668kb

input:

1 9
2

output:

2

result:

ok single line: '2'

Test #44:

score: 0
Accepted
time: 66ms
memory: 13436kb

input:

16498 80565
56756

output:

1

result:

ok single line: '1'

Test #45:

score: 0
Accepted
time: 64ms
memory: 13524kb

input:

15975 23849
69814

output:

0

result:

ok single line: '0'

Test #46:

score: 0
Accepted
time: 64ms
memory: 13224kb

input:

21354 64868
3299

output:

23

result:

ok single line: '23'

Test #47:

score: 0
Accepted
time: 62ms
memory: 12672kb

input:

1 100000
129

output:

1284

result:

ok single line: '1284'

Test #48:

score: 0
Accepted
time: 64ms
memory: 13900kb

input:

30521 89695
22212

output:

0

result:

ok single line: '0'

Test #49:

score: 0
Accepted
time: 63ms
memory: 13440kb

input:

1 1
99

output:

0

result:

ok single line: '0'

Test #50:

score: 0
Accepted
time: 64ms
memory: 13080kb

input:

1 9
99

output:

0

result:

ok single line: '0'

Test #51:

score: 0
Accepted
time: 63ms
memory: 13060kb

input:

1 10
9

output:

2

result:

ok single line: '2'

Test #52:

score: 0
Accepted
time: 51ms
memory: 13028kb

input:

500 1000
43

output:

26

result:

ok single line: '26'

Test #53:

score: 0
Accepted
time: 56ms
memory: 14184kb

input:

1 1000
00

output:

10

result:

ok single line: '10'