QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#515503 | #3812. Sheldon Numbers | Bacily# | AC ✓ | 2ms | 4064kb | C++23 | 1.4kb | 2024-08-11 18:08:48 | 2024-08-11 18:08:49 |
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;
auto shift =[&](lll num , lll curr){
while (curr--)num*=2;
return num ;
};
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 =shift(ans , m);
if (new_ans > y or sum + m > 63) {
break;
} else {
ans = new_ans;
sum += m;
}
} else {
lll new_ans = shift(ans , n ) + shift(1,n) - 1;
if (new_ans > 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: 1ms
memory: 3644kb
input:
1 10
output:
10
result:
ok single line: '10'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
70 75
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 2ms
memory: 4064kb
input:
0 9223372036854775807
output:
4809
result:
ok single line: '4809'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
99 99
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3728kb
input:
231 231
output:
1
result:
ok single line: '1'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3760kb
input:
3171 3171
output:
1
result:
ok single line: '1'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
7399 7399
output:
1
result:
ok single line: '1'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
792 792
output:
1
result:
ok single line: '1'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3536kb
input:
924 924
output:
1
result:
ok single line: '1'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3532kb
input:
25368 25368
output:
1
result:
ok single line: '1'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3536kb
input:
29596 29596
output:
1
result:
ok single line: '1'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
100 100
output:
0
result:
ok single line: '0'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
100 111
output:
0
result:
ok single line: '0'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
232 232
output:
0
result:
ok single line: '0'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
3172 3172
output:
0
result:
ok single line: '0'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
7400 7400
output:
0
result:
ok single line: '0'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
793 793
output:
0
result:
ok single line: '0'
Test #18:
score: 0
Accepted
time: 1ms
memory: 3508kb
input:
925 925
output:
0
result:
ok single line: '0'
Test #19:
score: 0
Accepted
time: 1ms
memory: 3532kb
input:
25369 25369
output:
0
result:
ok single line: '0'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
29597 29597
output:
0
result:
ok single line: '0'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
1700 1799
output:
3
result:
ok single line: '3'
Test #22:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
10 1000
output:
84
result:
ok single line: '84'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
100 100000
output:
241
result:
ok single line: '241'
Test #24:
score: 0
Accepted
time: 1ms
memory: 3532kb
input:
1000 10000000
output:
492
result:
ok single line: '492'
Test #25:
score: 0
Accepted
time: 1ms
memory: 3552kb
input:
10000 1000000000
output:
799
result:
ok single line: '799'
Test #26:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
100000 100000000000
output:
1250
result:
ok single line: '1250'
Test #27:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
1000000 10000000000000
output:
1769
result:
ok single line: '1769'