QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#86457#1902. Computational ethnographyAhmed_Abdelmegeed#WA 2ms3456kbC++201.4kb2023-03-09 21:58:062023-03-09 21:58:08

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-09 21:58:08]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3456kb
  • [2023-03-09 21:58:06]
  • 提交

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;
    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') {
            ans++;
            //cout << num << el;
        }
    }
    cout << ans << 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: 3408kb

input:

1
1000

output:

10

result:

ok 1 number(s): "10"

Test #2:

score: 0
Accepted
time: 2ms
memory: 3400kb

input:

20
40

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: 0
Accepted
time: 2ms
memory: 3388kb

input:

80
100

output:

0

result:

ok 1 number(s): "0"

Test #4:

score: 0
Accepted
time: 2ms
memory: 3368kb

input:

1
1

output:

1

result:

ok 1 number(s): "1"

Test #5:

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

input:

10
20

output:

0

result:

ok 1 number(s): "0"

Test #6:

score: 0
Accepted
time: 2ms
memory: 3404kb

input:

16
90

output:

0

result:

ok 1 number(s): "0"

Test #7:

score: 0
Accepted
time: 2ms
memory: 3456kb

input:

18
86

output:

0

result:

ok 1 number(s): "0"

Test #8:

score: 0
Accepted
time: 2ms
memory: 3380kb

input:

10
61

output:

0

result:

ok 1 number(s): "0"

Test #9:

score: -100
Wrong Answer
time: 1ms
memory: 3388kb

input:

239
1488

output:

2

result:

wrong answer 1st numbers differ - expected: '5', found: '2'