QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#398921#1902. Computational ethnographydarkroute#AC ✓30ms3684kbC++141.6kb2024-04-25 19:54:302024-04-25 19:54:34

Judging History

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

  • [2024-04-25 19:54:34]
  • 评测
  • 测评结果:AC
  • 用时:30ms
  • 内存:3684kb
  • [2024-04-25 19:54:30]
  • 提交

answer

//Practice, Practice, Practice

//#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>

#define debug(x) cerr << #x << " is " << x << endl;
#define Practice ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define el '\n'
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define ll long long
#define ull unsigned long long
#define one(x) __builtin_popcountll(x)
#define double long double
#define sz(x) x.size()
#define INF 1e9
#define int long long
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const int N = 2e6 + 6, SQ = 350, mod = 1e9 + 7, LOG = 21, base = 37;

bool fun(int x){
    int lo = 1, hi = 1e6;
    while(lo < hi){
        int mid = (lo + hi) / 2;
        if(mid * mid >= x){
            hi = mid;
        }
        else{
            lo = mid + 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() {
    long long a, b;
    cin >> a >> b;
    int ans = 0;
    for(int i = 1; i * i <= b; ++i){
        if(i * i >= a && fun(rev(i * i))) ans++;
    }
    cout << ans << el;
}
int32_t main(){
    Practice
    int testcases = 1;
    //cin >> testcases;
    for(; testcases; testcases--){
        doWork();
    }
    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3524kb

input:

1
1000

output:

10

result:

ok 1 number(s): "10"

Test #2:

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

input:

20
40

output:

0

result:

ok 1 number(s): "0"

Test #3:

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

input:

80
100

output:

0

result:

ok 1 number(s): "0"

Test #4:

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

input:

1
1

output:

1

result:

ok 1 number(s): "1"

Test #5:

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

input:

10
20

output:

0

result:

ok 1 number(s): "0"

Test #6:

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

input:

16
90

output:

0

result:

ok 1 number(s): "0"

Test #7:

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

input:

18
86

output:

0

result:

ok 1 number(s): "0"

Test #8:

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

input:

10
61

output:

0

result:

ok 1 number(s): "0"

Test #9:

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

input:

239
1488

output:

5

result:

ok 1 number(s): "5"

Test #10:

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

input:

1
1000000

output:

30

result:

ok 1 number(s): "30"

Test #11:

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

input:

402910
786629

output:

1

result:

ok 1 number(s): "1"

Test #12:

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

input:

749966
979696

output:

0

result:

ok 1 number(s): "0"

Test #13:

score: 0
Accepted
time: 8ms
memory: 3532kb

input:

22256537691
50530181412

output:

66

result:

ok 1 number(s): "66"

Test #14:

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

input:

34950561102
36206697992

output:

0

result:

ok 1 number(s): "0"

Test #15:

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

input:

1
100000000000

output:

381

result:

ok 1 number(s): "381"

Test #16:

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

input:

100000000000
100000000000

output:

0

result:

ok 1 number(s): "0"

Test #17:

score: 0
Accepted
time: 29ms
memory: 3532kb

input:

100000000
100000000000

output:

308

result:

ok 1 number(s): "308"