QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#60068 | #1902. Computational ethnography | Mostafa_Moharram# | AC ✓ | 8ms | 3720kb | C++17 | 906b | 2022-11-02 19:41:27 | 2022-11-02 19:41:28 |
Judging History
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"