QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#515490 | #3812. Sheldon Numbers | Bacily# | WA | 1ms | 3872kb | C++23 | 1.3kb | 2024-08-11 18:02:55 | 2024-08-11 18:02: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 xx, yy;
cin >> xx >> yy;
lll x = xx , y = yy ;
set<lll> 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 sum + m > 63) {
break;
} else {
ans = new_ans;
sum += m;
}
} else {
lll new_ans = (ans << n) + (1ll << n) - 1;
if (new_ans > (lll) y or sum + n > 63)break;
else ans = new_ans, sum += n;
}
if (ans >= x and ans <= y) {
st.insert(ans);
}
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: 3660kb
input:
1 10
output:
10
result:
ok single line: '10'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
70 75
output:
1
result:
ok single line: '1'
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3872kb
input:
0 9223372036854775807
output:
4808
result:
wrong answer 1st lines differ - expected: '4809', found: '4808'