You are viewing a single comment's thread. Return to all comments →
using namespace std;
long strangeCounter(long t) { long cycle_start = 1; long cycle_length = 3;
while (cycle_start + cycle_length <= t) { cycle_start += cycle_length; cycle_length *= 2; } return cycle_length - (t - cycle_start);
}
int main() { ios::sync_with_stdio(false); cin.tie(NULL);
long t; cin >> t; cout << strangeCounter(t) << "\n"; return 0;
Seems like cookies are disabled on this browser, please enable them to open this website
Strange Counter
You are viewing a single comment's thread. Return to all comments →
include
using namespace std;
long strangeCounter(long t) { long cycle_start = 1; long cycle_length = 3;
}
int main() { ios::sync_with_stdio(false); cin.tie(NULL);
}