要求:A quadratic solution is not acceptedlet array A contain N positive numbers.determine the maximun value of A[j]/A[i],where j>i.for instance,if the array contains 4,6,,2,4,5 ,1 ,3,then the maximuc value is 3,determined by the seventh and eight
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 22:44:31
要求:A quadratic solution is not acceptedlet array A contain N positive numbers.determine the maximun value of A[j]/A[i],where j>i.for instance,if the array contains 4,6,,2,4,5 ,1 ,3,then the maximuc value is 3,determined by the seventh and eight
要求:A quadratic solution is not accepted
let array A contain N positive numbers.determine the maximun value of A[j]/A[i],where j>i.for instance,if the array contains 4,6,,2,4,5 ,1 ,3,then the maximuc value is 3,determined by the seventh and eighth element.
比如数组 1000 10001 1002 10 100 200 300 3 10 2 6 1 3
最大是A[7]/A[4]=300/10=30
给个小于O(n^2)的算法~
要求:A quadratic solution is not acceptedlet array A contain N positive numbers.determine the maximun value of A[j]/A[i],where j>i.for instance,if the array contains 4,6,,2,4,5 ,1 ,3,then the maximuc value is 3,determined by the seventh and eight
double Minimum=data[1],Answer=0.;
for(int i=2;i