diff --git a/Algorithms/Implementation/strangecounter.cpp b/Algorithms/Implementation/strangecounter.cpp new file mode 100644 index 0000000..157a3f7 --- /dev/null +++ b/Algorithms/Implementation/strangecounter.cpp @@ -0,0 +1,14 @@ +#include +using namespace std; + +int main() { + unsigned long long val = 3; + unsigned long long idx = 1; + unsigned long long t; cin >> t; + while (t-idx >= val) { + idx += val; + val *= 2; + } + cout << val - (t - idx); + return 0; +}