QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#86461 | #1902. Computational ethnography | Ahmed_Abdelmegeed# | WA | 2ms | 3480kb | C++20 | 1.5kb | 2023-03-09 22:02:20 | 2023-03-09 22:02:23 |
Judging History
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define ld long double
#define el "\n"
#define matrix vector<vector<int>>
#define pt complex<ld>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_multiset tree<ll, null_type,less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update>
using namespace __gnu_pbds;
using namespace std;
const ll N = 1e5 + 5, LOG = 20, INF = 1e18;
const ld pi = acos(-1);
const ll mod = 1e9 + 7;
const ld eps = 1e-12;
int dx[] = {0, 1, 0, -1, -1, 1, -1, 1};
int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
ll n, m, x, y, k;
void dowork() {
cin >> x >> y;
ll ans = 0, num, tmp;
string s;
set<ll>st;
for (ll i = 1; i * i <= y; i++) {
num = i * i;
s = to_string(num);
reverse(s.begin(), s.end());
num = stoll(s);
tmp = sqrt(num);
if (tmp * tmp == num && num <= y && num >= x && i * i >= x && i * i <= y && s[0] != '0') {
st.insert(num);
//cout << num << el;
}
}
cout << st.size() << el;
}
signed main() {
fast
//freopen("lis.in", "r", stdin);
//freopen("bitwise.out", "w", stdout);
int t = 1;
//cin >> t;
for (int i = 1; i <= t; i++) {
dowork();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3472kb
input:
1 1000
output:
10
result:
ok 1 number(s): "10"
Test #2:
score: 0
Accepted
time: 2ms
memory: 3452kb
input:
20 40
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 1ms
memory: 3460kb
input:
80 100
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 0
Accepted
time: 1ms
memory: 3384kb
input:
1 1
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 2ms
memory: 3480kb
input:
10 20
output:
0
result:
ok 1 number(s): "0"
Test #6:
score: 0
Accepted
time: 2ms
memory: 3372kb
input:
16 90
output:
0
result:
ok 1 number(s): "0"
Test #7:
score: 0
Accepted
time: 2ms
memory: 3384kb
input:
18 86
output:
0
result:
ok 1 number(s): "0"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3456kb
input:
10 61
output:
0
result:
ok 1 number(s): "0"
Test #9:
score: -100
Wrong Answer
time: 0ms
memory: 3472kb
input:
239 1488
output:
2
result:
wrong answer 1st numbers differ - expected: '5', found: '2'