QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#86456#1902. Computational ethnographytriplem5ds#AC ✓32ms3544kbC++201.9kb2023-03-09 21:57:482023-03-09 21:57:50

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:57:50]
  • 评测
  • 测评结果:AC
  • 用时:32ms
  • 内存:3544kb
  • [2023-03-09 21:57:48]
  • 提交

answer

///Enta etfsh5t nseet el rank

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")

#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
        tree_order_statistics_node_update>;
#define pb push_back
#define F first
#define S second
#define f(i, a, b) for (int i = a; i < b; i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
//#define mp(x, y) make_pair(x, y)
#define popCnt(x) (__builtin_popcountll(x))
#define int ll

using ll = long long;
using ull = unsigned long long;
using uint = uint32_t;
using ii = pair<int, int>;

const int N = 3e6 + 6, A = 26, LG = 18, MOD = (119 << 23) + 1;
const long double PI = acos(-1);
const long double EPS = 1e-9;
const ll INF = 1e15;

bool isSquare(int x) {
    int lo = 1, hi = 1e6;

    while (lo < hi) {
        int md = lo + (hi - lo) / 2;
        if (md * md >= x)
            hi = md;
        else
            lo = md + 1;
    }
    return lo * lo == x;
}

int rev(int x) {
    if (x % 10 == 0)return 0;
    int ret = 0;
    while (x) {
        ret = ret * 10 + (x % 10);
        x /= 10;
    }
    return ret;
}


void doWork() {

    int L, R;
    cin >> L >> R;
    int ans = 0;
    for (int i = 1; i * i <= R; i++) {
        if (i * i >= L && isSquare(rev(i * i))) {
            ans += 1;
        }
    }
    cout << ans << '\n';

}


int32_t main() {
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif // ONLINE_JUDGE
    int t = 1;
//    cin >> t;
    while (t--)
        doWork();

    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3364kb

input:

1
1000

output:

10

result:

ok 1 number(s): "10"

Test #2:

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

input:

20
40

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3356kb

input:

80
100

output:

0

result:

ok 1 number(s): "0"

Test #4:

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

input:

1
1

output:

1

result:

ok 1 number(s): "1"

Test #5:

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

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: 3516kb

input:

18
86

output:

0

result:

ok 1 number(s): "0"

Test #8:

score: 0
Accepted
time: 0ms
memory: 3316kb

input:

10
61

output:

0

result:

ok 1 number(s): "0"

Test #9:

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

input:

239
1488

output:

5

result:

ok 1 number(s): "5"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3360kb

input:

1
1000000

output:

30

result:

ok 1 number(s): "30"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3392kb

input:

402910
786629

output:

1

result:

ok 1 number(s): "1"

Test #12:

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

input:

749966
979696

output:

0

result:

ok 1 number(s): "0"

Test #13:

score: 0
Accepted
time: 6ms
memory: 3376kb

input:

22256537691
50530181412

output:

66

result:

ok 1 number(s): "66"

Test #14:

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

input:

34950561102
36206697992

output:

0

result:

ok 1 number(s): "0"

Test #15:

score: 0
Accepted
time: 30ms
memory: 3364kb

input:

1
100000000000

output:

381

result:

ok 1 number(s): "381"

Test #16:

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

input:

100000000000
100000000000

output:

0

result:

ok 1 number(s): "0"

Test #17:

score: 0
Accepted
time: 32ms
memory: 3360kb

input:

100000000
100000000000

output:

308

result:

ok 1 number(s): "308"