vitormartinotti

Untitled

Oct 13th, 2025
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. int main()
  4. {
  5.     //Leitura da entrada
  6.     int A, B, C, troca;
  7.     scanf("%d %d %d", &A, &B, &C);
  8.     int H, L;
  9.     scanf("%d %d", &H, &L);
  10.    
  11.     //Ordenando as dimensões
  12.     if(B < A){
  13.         troca = A;
  14.         A = B;
  15.         B = troca;
  16.     }
  17.     if(C < A){
  18.         troca = A;
  19.         A = C;
  20.         C = troca;
  21.     }
  22.     if(C < B){
  23.         troca = B;
  24.         B = C;
  25.         C = troca;
  26.     }
  27.     //(A,B,C) está ordenado
  28.     //ou seja, A e B são as menores dimensões
  29.     //tentaremos passar o colchão com essas duas dimensões
  30.     //se não der certo, é impossível passsar o colchão pela porta
  31.    
  32.     if(A <= H && B <= L){
  33.         printf("S");
  34.     }
  35.     else if(B <= H && A <= L){
  36.         printf("S");
  37.     }
  38.     else{
  39.         printf("N");
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment