Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- double availableArea;
- cin >> availableArea;
- string suitcaseVolume;
- cin >> suitcaseVolume;
- int loadedSuitcases = 0;
- while (suitcaseVolume != "End") {
- double currentSuitcaseVolume = stod(suitcaseVolume);
- if (++loadedSuitcases % 3 == 0) {
- currentSuitcaseVolume *= 1.1;
- }
- if (currentSuitcaseVolume > availableArea) {
- loadedSuitcases--;
- break;
- }
- availableArea -= currentSuitcaseVolume;
- cin >> suitcaseVolume;
- }
- if (suitcaseVolume == "End") {
- cout << "Congratulations! All suitcases are loaded!\n";
- }
- else {
- cout << "No more space!\n";
- }
- cout << "Statistic: " << loadedSuitcases << " suitcases loaded.\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement