Home > Back-end >  O algorithm
O algorithm

Time:09-20

30 RMB 20 kg
80 RMB 30 kg
Fifty yuan? Kg

I hope I can through the formula to estimate a value

CodePudding user response:

You this is the price of the same goods? Calculate by kg unit price, buy more expensive?
If it's the same item, the second formula to reduce the first formula, it is concluded that 50 RMB 10 kilograms, seems a little unreasonable, but the first formula and the third formula total price is 80 yuan, so the total number of kg not 30 violates the second formula, but only 50 yuan to buy 10 kilograms, it is better to buy 30 yuan, so a little unreasonable,

CodePudding user response:

I'm not reasonable, just a algorithm model
According to a model to estimate the weight of another object

CodePudding user response:

So tell how design can be, such as:
80-30/30-20 it is concluded that the value of the linear increase after the corresponding was 20 and 50 (50-30) * the added value of linear
This is also a kind of algorithm

CodePudding user response:

Just like two pairs of values are difficult to calculate the accurate function curve
Hypothesis is a meet exponential function curve y=a * x ^ b

 

Public class Test1 {
Public double js (double x1, double y1, double x2, double y2, double x3) {
Double y3=(y1/(math.h pow (x1, Math. The log (y1, y2)/Math. The log (x1 x2))))
* math.h pow (x3, Math. The log (y1, y2)/Math. The log (x1 x2));
Return y3.
}

Public static void main (String [] args) {
Test1 t=new Test1 ();
System. The out. Println (t.j s (30, 20, 80, 30, 50));
}
}




The calculation result is 24.7024525422488
  • Related