11559 Event Planning - UVa Online Judge
Haii haiii huehehehe.. 😏 meet again and now I will write a problem in UVa Online Judge that name is Event Planning 😀😀
The problem is to output the price for staying in a hotel (all participants must in same hotel) or stay home if there is not enough money to stay in.
It is easy 😊 you just need to loop all the hotel and check all the rooms that they have. The first thing that you should check about the hotel is the number of the room they have. If it has rooms at least or higher with the number of participants, then it should be processed to the next step 😀
The next step is to count the hotel prices multiply with participants, if it is larger than the budged has, then we should go to another hotel. If the budget is enough, let's processed it with the next step 😀😉
The next step (or last step) is to store the calculation of the price hotel multiplying with participant in a variable (e.g : variable ans), then compare it to the variable that will be outputted later. Because we will choose a hotel that are the cheapest, let's make a variable again that initialized with a huge number (e.g : ans2 = 500001), then we will compare that variable (ans2) with the variable before (ans) and assign it to the variable ans2. The comparison that be used is to search who's the minimum of both (ans2 or ans). From there, we got the answer where's the cheapest hotel that can be staying 😃😃😃😃😀😀😀😊
Let's check the code 😏
Okkayyy ^o^)/ I think that's all for this problem 😁😁😁 if you have questions or you want to request another problem, let me know from the comment below, okaay? 😁😁😀😉
(Link to download source code above is here)
Thank youuuu...
Label: C++, UVa Online Judge

0 Komentar:
Posting Komentar
Berlangganan Posting Komentar [Atom]
<< Beranda