Submission #1595365
Source Code Expand
#include <iostream> #define int long long using namespace std; int keta(int n){ int ret = 0; while(n){ ret++; n /= 2; } return ret; } int calc(int a,int b){ if(!a && !b) return 1; if(keta(a) == keta(b)) return calc(a - (1ll << (keta(a) - 1)),b - (1ll << (keta(a) - 1))); else return min(calc(1ll << (keta(b) - 1),b) + 1ll << (keta(b) - 1) - a),1ll << (keta(b) - 1)) + 1ll << (keta(b) - 1) - a; } signed main(){ int a,b; cin >> a >> b; cout << calc(a,b) << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - A or...or B Problem |
User | hoget157 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 518 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘long long int calc(long long int, long long int)’: ./Main.cpp:17:73: error: no matching function for call to ‘min(long long int)’ else return min(calc(1ll << (keta(b) - 1),b) + 1ll << (keta(b) - 1) - a),1ll << (keta(b) - 1)) + 1ll << (keta(b) - 1) - a; ^ In file included from /usr/include/c++/5/bits/char_traits.h:39:0, from /usr/include/c++/5/ios:40, from /usr/include/c++/5/ostream:38, from /usr/include/c++/5/iostream:39, from ./Main.cpp:1: /usr/include/c++/5/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/5/bits/stl_algobase.h:195:5: note: template argument deduction/substitution failed: ./Main.cpp:17:73: note: candidate expects 2 arguments, 1 provided else return min(calc(1ll << (keta(b) - 1),b) + 1ll <...