QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#608670#1902. Computational ethnographyrgnerdplayer#AC ✓12ms3864kbC++20755b2024-10-04 00:50:182024-10-04 00:50:20

Judging History

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

  • [2024-10-04 00:50:20]
  • 评测
  • 测评结果:AC
  • 用时:12ms
  • 内存:3864kb
  • [2024-10-04 00:50:18]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

using i64 = long long;

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    auto solve = [&]() {
        i64 A, B;
        cin >> A >> B;

        int ans = 0;

        for (i64 i = 1; i * i <= B; i++) {
            if (i * i < A) {
                continue;
            }
            i64 n = i * i;
            auto s = to_string(n);
            reverse(s.begin(), s.end());
            if (s[0] == '0') {
                continue;
            }
            n = stoll(s);
            i64 sq = sqrt(n);
            if (sq * sq == n) {
                ans++;
            }
        }

        cout << ans << '\n';
    };
    
    solve();
    
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3596kb

input:

1
1000

output:

10

result:

ok 1 number(s): "10"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

20
40

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

80
100

output:

0

result:

ok 1 number(s): "0"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3488kb

input:

1
1

output:

1

result:

ok 1 number(s): "1"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

10
20

output:

0

result:

ok 1 number(s): "0"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

16
90

output:

0

result:

ok 1 number(s): "0"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

18
86

output:

0

result:

ok 1 number(s): "0"

Test #8:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

10
61

output:

0

result:

ok 1 number(s): "0"

Test #9:

score: 0
Accepted
time: 0ms
memory: 3724kb

input:

239
1488

output:

5

result:

ok 1 number(s): "5"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

1
1000000

output:

30

result:

ok 1 number(s): "30"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

402910
786629

output:

1

result:

ok 1 number(s): "1"

Test #12:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

749966
979696

output:

0

result:

ok 1 number(s): "0"

Test #13:

score: 0
Accepted
time: 3ms
memory: 3864kb

input:

22256537691
50530181412

output:

66

result:

ok 1 number(s): "66"

Test #14:

score: 0
Accepted
time: 0ms
memory: 3512kb

input:

34950561102
36206697992

output:

0

result:

ok 1 number(s): "0"

Test #15:

score: 0
Accepted
time: 9ms
memory: 3804kb

input:

1
100000000000

output:

381

result:

ok 1 number(s): "381"

Test #16:

score: 0
Accepted
time: 1ms
memory: 3652kb

input:

100000000000
100000000000

output:

0

result:

ok 1 number(s): "0"

Test #17:

score: 0
Accepted
time: 12ms
memory: 3792kb

input:

100000000
100000000000

output:

308

result:

ok 1 number(s): "308"