标签:price turn void oid out main array ack ring
package Maxmoney;
public class maxmoney {
public static void main(String[] args) {
int array[]={8,6,5,4,5};
System.out.println(maxmoney(array));
}
public static int maxmoney(int[]prices){
int i,j,k;
int M=0;
for(i=0;i<prices.length-1;i++){
for(k=1;k<prices.length;k++){
j=prices[k]-prices[i];
if(j>0&j>M){
M=j;
}
}
}
return M;
}
标签:price turn void oid out main array ack ring
原文地址:http://www.cnblogs.com/suojixin/p/6524881.html