Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 146873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:40:51+00:00 2026-05-11T08:40:51+00:00

in another post, MSN gave me a good guide on solving my algebra problem

  • 0

in another post, MSN gave me a good guide on solving my algebra problem (Calculating bid price from total cost). Now, even though I can calculate it by hand, I’m completely stuck on how to write this in pseudocode or code. Anyone could give me a quick hint? By the way, I want to calculate the bid given the final costs .

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 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:40:52+00:00Added an answer on May 11, 2026 at 8:40 am

    The function simplifies to:

                      / 1.02 * bid + 115   bid <   100                   | 1.12 * bid + 105   bid <=  500 final cost(bid) = | 1.02 * bid + 160   bid <= 1000                   | 1.02 * bid + 165   bid <= 3000                   \ 1.02 * bid + 170   otherwise 

    If you consider each piece as a separate function, they can be inverted:

    bid_a(cost) = (cost - 115) / 1.02 bid_b(cost) = (cost - 105) / 1.12 bid_c(cost) = (cost - 160) / 1.02 bid_d(cost) = (cost - 165) / 1.02 bid_e(cost) = (cost - 170) / 1.02 

    If you plug your cost into each function you get an estimated bid value for that range. You must check that this value indeed is within that functions valid range.

    Example:

    cost = 2000  bid_a(2000) = (2000 - 115) / 1.02 = 1848  Too big! Need to be < 100 bid_b(2000) = (2000 - 105) / 1.12 = 1692  Too big! Need to be <= 500 bid_c(2000) = (2000 - 160) / 1.02 = 1804  Too big! Need to be <= 1000 bid_d(2000) = (2000 - 165) / 1.02 = 1799  Good. It is <= 3000 bid_e(2000) = (2000 - 170) / 1.02 = 1794  Too small! Need to be > 3000  Just to check:  final cost(1799) = 1.02 * 1799 + 165 = 2000   Good! 

    Since the original function is strictly increasing, at most one of those functions will give an acceptable value. But for some inputs none of them will give a good value. This is because the original function jumps over those values.

    final cost(1000) = 1.02 * 1000 + 160 = 1180 final cost(1001) = 1.02 * 1001 + 165 = 1186 

    So no function will give an acceptable value for cost = 1182 for example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 154k
  • Answers 154k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Best I could come up with was to use the… May 12, 2026 at 10:26 am
  • Editorial Team
    Editorial Team added an answer You have to just call it like a static method:… May 12, 2026 at 10:26 am
  • Editorial Team
    Editorial Team added an answer There are a couple of things you should think about… May 12, 2026 at 10:26 am

Related Questions

I noticed in another post, someone had done something like: double d = 3.1415;
I had read in another post here on SO that when possible you shouldn't
I've just recently setup a custom replication for my subscriber database, as described in
One of my favorite postgres aggregates is list, attributed to Chris Rohlfs in the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.