Sort by

recency

|

1790 Discussions

|

  • + 0 comments

    Here is my Python solution! If Ana paid the right amount of money, we print "Bon Appetit" and if not, we print the amount that Ana should be refunded (The amount Ana paid minus the actual amount she should have paid).

    def bonAppetit(bill, k, b):
        if (sum(bill) - bill[k]) / 2 == b:
            print("Bon Appetit")
        else:
            print(str(int(b - (sum(bill) - bill[k]) / 2)))
    
  • + 0 comments

    If you're looking for a reliable commercial flooring contractor, Bill Division is a great choice! They offer top-notch services for all types of flooring needs, ensuring a smooth and professional experience from start to finish. Whether it's for an office, retail space, or any other commercial setting, they've got you covered with expert installation and quality materials. Definitely a team you can trust!

  • + 1 comment

    Python 2 lines solution (tryhards only)

    def bonAppetit(bill, k, b):
        bill.pop(k)
        print("Bon Appetit" if (sum(bill)//2) == b else f"{b-sum(bill)//2}")
    
  • + 0 comments

    Here is my c++ solution you can find the video here : https://youtu.be/MHFroRIBGQc

    void bonAppetit(vector<int> bill, int k, int b) {
        int s = accumulate(bill.begin(), bill.end(), -1 * bill[k]);
        int c = s / 2;
        if(c == b) cout << "Bon Appetit";
        else cout << b - c;
    }
    
  • + 0 comments

    Splitting bills can be tricky, like when you're with friends at a restaurant. It's like if Top Roofing Contractors in Hartsville charged everyone equally for a job, even if some didn't need the full service.