Advertisement
_no0B

Untitled

Jul 23rd, 2021
1,230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1.  
  2.  
  3. #include<bits/stdc++.h>
  4. #define ll long long
  5. #define fastio ios_base::sync_with_stdio(false),cin.tie(NULL)
  6. #define N ((int)1e6 + 9)
  7. #define endl "\n"
  8.  
  9. using namespace std;
  10.  
  11.  
  12. /*fast io
  13. ios_base::sync_with_stdio(false);
  14. cin.tie(NULL);
  15. */
  16.  
  17. /// stack
  18.  
  19. int main()
  20. {
  21. //    fastio;
  22.  
  23.     int n;
  24.     cin>>n;
  25.     stack < int > stt;
  26.     while(n > 0){
  27.         n--;
  28.         int a;
  29.         cin>>a;
  30.         stt.push(a);
  31.     }
  32.     while(stt.empty() == 0){
  33.         int a = stt.top();
  34.         stt.pop();
  35.         cout<<a<<endl;
  36.     }
  37.     return 0;
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement