Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions Airline/airline.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#include<iostream>
using namespace std;

//Creating a class Luggage containing all information about the luggage
class Luggage
{
public:
int A,B,C,D,E;
int compare()
{
//All the possible conditions for which luggage is allowed and we return the function
if(A+B<=D)
{
if(C<=E)
{
cout<<"YES"<<endl;
return 0;
}
}
if(B+C<=D)
{
if(A<=E)
{
cout<<"YES"<<endl;
return 0;
}
}
if(A+C<=D)
{
if(B<=E)
{
cout<<"YES"<<endl;
return 0;
}
}
//If any of the above conditions fails then luggage is not allowed and 0 is returned.
cout<<"NO"<<endl;
return 0;
}
};

int main()
{
//Getting total number of cases
int x;
cin>>x;
//Array of object consisting of information about every case
Luggage l[x];

for(int i = 0; i < x; i++)
{
cin>>l[i].A>>l[i].B>>l[i].C>>l[i].D>>l[i].E;
}

//Calling the function for every case
for(int i = 0;i<x;i++)
{
l[i].compare();
}

return 0;
}
1 change: 1 addition & 0 deletions Airline/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[AIRLINE](https://www.codechef.com/SEPT21C/problems/AIRLINE)