import java.util.Arrays; import java.util.Scanner; public class Main{ static int n,m; static double v[],w[]; static double cnt[]; public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt();v=new double[100005];w=new double[100005]; cnt=new double[100005]; double an,s,mid; while(t-->0) { n=sc.nextInt();m=sc.nextInt(); for (int i =1; i <=n; i++) { w[i]=sc.nextDouble();v[i]=sc.nextDouble(); } an=0;s=100000; for (int i =1; i <100;i++) { mid=(an+s)/2; if(check(mid)) { an=mid; }else { s=mid; } } System.out.println(String.format("%.2f",an)); } } public static boolean check(double c) { double t=0; for (int i =1; i <=n; i++) { cnt[i]=v[i]-w[i]*c; } Arrays.sort(cnt,1,n+1); for (int i =1; i <=m; i++) { t+=cnt[n-i+1]; } if(t>=0)return true; return false; } }