QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#344863 | #3812. Sheldon Numbers | KhNURE_KIVI# | WA | 1ms | 3764kb | C++14 | 1.7kb | 2024-03-05 16:33:11 | 2024-03-05 16:33:12 |
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)
{
ll 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<62;a++){
for (int b=1;b<62;b++){
string s=string(a,'1');
bool type=1;
while (len(s)<62){
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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3564kb
input:
1 10
output:
10
result:
ok single line: '10'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3764kb
input:
70 75
output:
1
result:
ok single line: '1'
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3600kb
input:
0 9223372036854775807
output:
4502
result:
wrong answer 1st lines differ - expected: '4809', found: '4502'