QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#60073 | #1902. Computational ethnography | Sa3tElSefr# | AC ✓ | 20ms | 3708kb | C++23 | 1.8kb | 2022-11-02 19:52:32 | 2022-11-02 19:52:33 |
Judging History
answer
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <array>
#include <climits>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <array>
#include <climits>
//#pragma GCC optimize("O3")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#define ll long long
#define ld double
using namespace std;
const int N = 5e2 + 5, lg = 19, mod = 998244353;
const int M = 1e6 + 5;
const int b = 31;
bool is_perfect_square(ll num) {
ll root = round(sqrtl(num));
return root * root == num;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ll a, b;
cin >> a >> b;
ll st = 1;
while (st * st < a) {
++st;
}
int ans = 0;
for (ll i = st; i * i <= b; ++i) {
auto str = to_string(i * i);
reverse(str.begin(), str.end());
if (str.front() == '0') {
continue;
}
auto rev = stoll(str);
if (is_perfect_square(rev)) {
++ans;
}
}
cout << ans << '\n';
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3700kb
input:
1 1000
output:
10
result:
ok 1 number(s): "10"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
20 40
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 2ms
memory: 3556kb
input:
80 100
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 0
Accepted
time: 2ms
memory: 3528kb
input:
1 1
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
10 20
output:
0
result:
ok 1 number(s): "0"
Test #6:
score: 0
Accepted
time: 2ms
memory: 3512kb
input:
16 90
output:
0
result:
ok 1 number(s): "0"
Test #7:
score: 0
Accepted
time: 2ms
memory: 3552kb
input:
18 86
output:
0
result:
ok 1 number(s): "0"
Test #8:
score: 0
Accepted
time: 2ms
memory: 3692kb
input:
10 61
output:
0
result:
ok 1 number(s): "0"
Test #9:
score: 0
Accepted
time: 2ms
memory: 3548kb
input:
239 1488
output:
5
result:
ok 1 number(s): "5"
Test #10:
score: 0
Accepted
time: 2ms
memory: 3660kb
input:
1 1000000
output:
30
result:
ok 1 number(s): "30"
Test #11:
score: 0
Accepted
time: 2ms
memory: 3516kb
input:
402910 786629
output:
1
result:
ok 1 number(s): "1"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
749966 979696
output:
0
result:
ok 1 number(s): "0"
Test #13:
score: 0
Accepted
time: 7ms
memory: 3612kb
input:
22256537691 50530181412
output:
66
result:
ok 1 number(s): "66"
Test #14:
score: 0
Accepted
time: 2ms
memory: 3564kb
input:
34950561102 36206697992
output:
0
result:
ok 1 number(s): "0"
Test #15:
score: 0
Accepted
time: 16ms
memory: 3608kb
input:
1 100000000000
output:
381
result:
ok 1 number(s): "381"
Test #16:
score: 0
Accepted
time: 2ms
memory: 3504kb
input:
100000000000 100000000000
output:
0
result:
ok 1 number(s): "0"
Test #17:
score: 0
Accepted
time: 20ms
memory: 3688kb
input:
100000000 100000000000
output:
308
result:
ok 1 number(s): "308"