QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#344865 | #3812. Sheldon Numbers | KhNURE_KIVI# | AC ✓ | 2ms | 3840kb | C++14 | 1.8kb | 2024-03-05 16:34:31 | 2024-03-05 16:34:31 |
Judging History
answer
//
// Created by Barichek on 05.03.2024 09:26:58
//
#include <bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define all(a) a.begin(), a.end()
#define len(a) (int) (a.size())
#define mp make_pair
#define pb push_back
#define fir first
#define sec second
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
#ifdef Energy_is_not_over
#define DEBUG for (bool ____DEBUG = true; ____DEBUG; ____DEBUG = false)
#define LOG(...) print(#__VA_ARGS__" ::", __VA_ARGS__) << endl
template<class ...Ts>
auto &print(Ts ...ts) { return ((cerr << ts << " "), ...); }
#else
#define DEBUG while (false)
#define LOG(...)
#endif
const int max_n = -1, inf = 1000111222;
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);
ll l,r;
cin>>l>>r;
auto good=[&](string s)
{
__int128 res=0;
for (auto i:s){
res*=2;
if (i=='1'){
res++;
}
}
// LOG(s,res);
return res>=l && res<=r;
};
int ans=0;
for (int a=1;a<=64;a++){
for (int b=1;b<=64;b++){
string s=string(a,'1');
bool type=1;
while (len(s)<=64){
if (good(s) && (len(s)>a || (b==1 && len(s)==a))){
// LOG(s);
ans++;
}
if (type){
s+=string(b,'0');
}
else{
s+=string(a,'1');
}
type^=1;
}
}
}
cout<<ans<<"\n";
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3540kb
input:
1 10
output:
10
result:
ok single line: '10'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
70 75
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3544kb
input:
0 9223372036854775807
output:
4809
result:
ok single line: '4809'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3832kb
input:
99 99
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3780kb
input:
231 231
output:
1
result:
ok single line: '1'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3832kb
input:
3171 3171
output:
1
result:
ok single line: '1'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
7399 7399
output:
1
result:
ok single line: '1'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
792 792
output:
1
result:
ok single line: '1'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
924 924
output:
1
result:
ok single line: '1'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3548kb
input:
25368 25368
output:
1
result:
ok single line: '1'
Test #11:
score: 0
Accepted
time: 2ms
memory: 3488kb
input:
29596 29596
output:
1
result:
ok single line: '1'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3540kb
input:
100 100
output:
0
result:
ok single line: '0'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3760kb
input:
100 111
output:
0
result:
ok single line: '0'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
232 232
output:
0
result:
ok single line: '0'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
3172 3172
output:
0
result:
ok single line: '0'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
7400 7400
output:
0
result:
ok single line: '0'
Test #17:
score: 0
Accepted
time: 2ms
memory: 3764kb
input:
793 793
output:
0
result:
ok single line: '0'
Test #18:
score: 0
Accepted
time: 1ms
memory: 3768kb
input:
925 925
output:
0
result:
ok single line: '0'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
25369 25369
output:
0
result:
ok single line: '0'
Test #20:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
29597 29597
output:
0
result:
ok single line: '0'
Test #21:
score: 0
Accepted
time: 2ms
memory: 3820kb
input:
1700 1799
output:
3
result:
ok single line: '3'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
10 1000
output:
84
result:
ok single line: '84'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
100 100000
output:
241
result:
ok single line: '241'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
1000 10000000
output:
492
result:
ok single line: '492'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
10000 1000000000
output:
799
result:
ok single line: '799'
Test #26:
score: 0
Accepted
time: 1ms
memory: 3784kb
input:
100000 100000000000
output:
1250
result:
ok single line: '1250'
Test #27:
score: 0
Accepted
time: 2ms
memory: 3568kb
input:
1000000 10000000000000
output:
1769
result:
ok single line: '1769'