搜题
问题   更新时间2023/6/29 19:52:00

class ABC {
int a,b;
public ABC(int a, int b) {this.a=a; this.b=b;}
public int compareTo(ABC x) {return a*b-x.a*x.b;}
}
public class XXK5 {
public static void main(String[] args) {
int [][]d=//;
ABC []ar=new ABC[d.length];
int i,k=0;
for(i=0; iar[i]=new ABC(d[i][0],d[i][1]);
for(i=1; iif(ar[i].compareTo(ar[k])>0) k=i;
System.out.println("k="+k);
}
}

【A.】k=2
【B.】k=4

王老师:19139051760(拨打)