एक और पोस्ट में, एमएसएन मुझे मेरी बीजगणित समस्या (सुलझाने पर एक अच्छा मार्गदर्शक दिया कुल लागत से बोली मूल्य की गणना कर रहा )। अब, भले ही मैं इसे हाथ से गणना कर सकते हैं, मैं पूरी तरह से कैसे स्यूडोकोड या कोड में यह लिखने के लिए पर अटक कर रहा हूँ। किसी को भी मुझे एक त्वरित संकेत दे सकता है? वैसे, मैं अंतिम लागत को देखते हुए बोली की गणना करना चाहते हैं।
usage cost(bid) = PIN(bid*0.10, 10, 50)
seller cost(bid) = bid*.02
added cost(bid) = PIN(ceiling(bid/500)*5, 5, 10) + PIN(ceiling((bid - 1000)/2000)*5, 0, 10)
storing cost(bid) = 100
So the final cost is something like:
final cost(bid) = PIN(bid*.1, 10, 50) + pin(ceiling(bid/500)*5, 5, 20) + PIN(ceiling((bid - 1000)/2000)*10, 0, 20) + bid*.02 + 100 + bid
Solve for a particular value and you're done.
For example, if you want the total cost to be $2000:
2000 = PIN(bid*.1, 10, 50) + pin(ceiling(bid/500)*5, 5, 10) + PIN(ceiling((bid - 1000)/2000)*5, 0, 10) + bid*.02 + 100 + bid.
Bid must be at least > 1500 and < 2000, which works out nicely since we can make those PIN sections constant:
2000 = 50 + 10 + 5 + 100 + bid*1.02
1835 = bid*1.02
bid = 1799.0196078431372549019607843137













