Open utterances-bot opened 1 year ago
https://oj.luyencode.net/problem/TASKSET
Đây là lời giải của mình đã AC. C++.
```c++ #include #define fast() ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) using namespace std; typedef long long ll; // const int N = 1e6+2; // int n; ll th1(ll n) { ll res(1); while (res * 2 < n) res *= 2; return n - res; } ll th2(ll n) { ll res(3); while (res * 2 < n) res *= 2; return n - res; } int main() { fast(); ll n; cin >> n; ll x = th1(n), y = th2(n); if (x == 0 || y == 0) cout << 0; else cout << min(x, y); return 0; } ```
Chi tiết bài tập - undefined
https://oj.luyencode.net/problem/TASKSET