QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#60068#1902. Computational ethnographyMostafa_Moharram#AC ✓8ms3720kbC++17906b2022-11-02 19:41:272022-11-02 19:41:28

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-02 19:41:28]
  • 评测
  • 测评结果:AC
  • 用时:8ms
  • 内存:3720kb
  • [2022-11-02 19:41:27]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;

ll rev(ll x) {
    ll ret = 0;
    for (; x; x /= 10) {
        if (ret == 0 and x % 10 == 0)
            return -1;
        ret = ret * 10 + x % 10;
    }
    return ret;
}

int main() {
    ios::sync_with_stdio(false); cout.tie(nullptr); cin.tie(nullptr);
    vector<ll> numbers;
    for (ll i = 1; i * i <= 1e11l; ++i) {
        ll number = i * i;
        ll tmp = rev(number);
        if (tmp == -1) continue;
        ll s = sqrtl(tmp);
        if (s * s != tmp)
            continue;
        numbers.push_back(number);
    }
    ll a, b;
    cin >> a >> b;
    int s = (int) (lower_bound(numbers.begin(), numbers.end(), a) - numbers.begin());
    int e = (int) (upper_bound(numbers.begin(), numbers.end(), b) - numbers.begin());
    cout << e - s << '\n';
    return 0;
}

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

詳細信息

Test #1:

score: 100
Accepted
time: 8ms
memory: 3540kb

input:

1
1000

output:

10

result:

ok 1 number(s): "10"

Test #2:

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

input:

20
40

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: 0
Accepted
time: 7ms
memory: 3616kb

input:

80
100

output:

0

result:

ok 1 number(s): "0"

Test #4:

score: 0
Accepted
time: 7ms
memory: 3708kb

input:

1
1

output:

1

result:

ok 1 number(s): "1"

Test #5:

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

input:

10
20

output:

0

result:

ok 1 number(s): "0"

Test #6:

score: 0
Accepted
time: 7ms
memory: 3500kb

input:

16
90

output:

0

result:

ok 1 number(s): "0"

Test #7:

score: 0
Accepted
time: 7ms
memory: 3556kb

input:

18
86

output:

0

result:

ok 1 number(s): "0"

Test #8:

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

input:

10
61

output:

0

result:

ok 1 number(s): "0"

Test #9:

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

input:

239
1488

output:

5

result:

ok 1 number(s): "5"

Test #10:

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

input:

1
1000000

output:

30

result:

ok 1 number(s): "30"

Test #11:

score: 0
Accepted
time: 7ms
memory: 3536kb

input:

402910
786629

output:

1

result:

ok 1 number(s): "1"

Test #12:

score: 0
Accepted
time: 7ms
memory: 3560kb

input:

749966
979696

output:

0

result:

ok 1 number(s): "0"

Test #13:

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

input:

22256537691
50530181412

output:

66

result:

ok 1 number(s): "66"

Test #14:

score: 0
Accepted
time: 7ms
memory: 3560kb

input:

34950561102
36206697992

output:

0

result:

ok 1 number(s): "0"

Test #15:

score: 0
Accepted
time: 7ms
memory: 3632kb

input:

1
100000000000

output:

381

result:

ok 1 number(s): "381"

Test #16:

score: 0
Accepted
time: 7ms
memory: 3564kb

input:

100000000000
100000000000

output:

0

result:

ok 1 number(s): "0"

Test #17:

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

input:

100000000
100000000000

output:

308

result:

ok 1 number(s): "308"