Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- #define sz(s) (int)(s).size()
- #define all(s) s.begin(),s.end()
- void Speed() {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- }
- void solve() {
- int n,l,k;
- cin>>n>>l>>k;
- vector<pair<int,int>>v(n);
- for(auto &[x,y]:v)cin>>x>>y;
- int ans=1e9;
- auto get=[&](ll r)->int{
- int c=0;
- for(auto [x,y]:v){
- ll d=1ll*x*x+1ll*y*y;
- while(r*r<d){
- r*=2;
- c++;
- }
- }
- return c;
- };
- for(int i=0;i<40;i++){
- ans=min(ans,i+get(0ll+l+1ll*i*k));
- }
- cout<<ans<<'\n';
- }
- int main() {
- Speed();
- int tc = 1;
- cin >> tc;
- while (tc--) {
- solve();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment