Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- int main()
- {
- //Leitura da entrada
- int A, B, C, troca;
- scanf("%d %d %d", &A, &B, &C);
- int H, L;
- scanf("%d %d", &H, &L);
- //Ordenando as dimensões
- if(B < A){
- troca = A;
- A = B;
- B = troca;
- }
- if(C < A){
- troca = A;
- A = C;
- C = troca;
- }
- if(C < B){
- troca = B;
- B = C;
- C = troca;
- }
- //(A,B,C) está ordenado
- //ou seja, A e B são as menores dimensões
- //tentaremos passar o colchão com essas duas dimensões
- //se não der certo, é impossível passsar o colchão pela porta
- if(A <= H && B <= L){
- printf("S");
- }
- else if(B <= H && A <= L){
- printf("S");
- }
- else{
- printf("N");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment