QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#515474#3812. Sheldon NumbersBacily#WA 1ms3836kbC++231.4kb2024-08-11 17:57:552024-08-11 17:57:56

Judging History

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

  • [2024-08-11 17:57:56]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3836kb
  • [2024-08-11 17:57:55]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
#define sz(x) (int)x.size()
#define lll __int128
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


void func() {
    long long x, y;
    cin >> x >> y;
    int cnt = 0;
    auto shift = [&](lll par, lll num) {
        while (num--)par *= 2;
        return par;
    };
    set<long long>st  ;
    for (int n = 1; n <= 63; n++) {
        for (int m = 1; m <= 63; m++) {
            lll ans = 0;
            bool curr = 0;
            int sum = 0 ;
            while (sum<=63) {

                if (curr) {
                    lll new_ans = (ans << m);
                    if (new_ans > (lll) y or new_ans < 0 ) {
                        break;
                    } else {
                        ans = new_ans;
                        sum+=m ;
                    }
                } else {
                    lll new_ans = (ans << n) + (1 << n) - 1;
                    if (new_ans > (lll) y or new_ans < 0 )break;
                    else ans = new_ans  , sum+=n;
                }
                if (ans >= x and ans <= y){
                    st.insert(ans) ;
                    cnt++;
                }
                curr ^= 1;
            }
        }
    }
    cout << sz(st) << '\n';
}

int main() {

    int t = 1;
    //cin >> t;
    for (int i = 0; i < t; i++) {
        func();
    }
}
// 5 3 1 2 4

詳細信息

Test #1:

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

input:

1 10

output:

10

result:

ok single line: '10'

Test #2:

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

input:

70 75

output:

1

result:

ok single line: '1'

Test #3:

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

input:

0 9223372036854775807

output:

4248

result:

wrong answer 1st lines differ - expected: '4809', found: '4248'