QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#515474 | #3812. Sheldon Numbers | Bacily# | WA | 1ms | 3836kb | C++23 | 1.4kb | 2024-08-11 17:57:55 | 2024-08-11 17:57:56 |
Judging History
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'