Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stack>
- using namespace std;
- int main(){
- int n;
- cin>>n;
- stack<int>p;
- int x;
- for(int i=0; i<n; ++i){
- cin>>x;
- p.push(x);
- }
- stack<int>q;
- q=p;
- stack<int>r;
- while(not q.empty()){
- r.push(q.top());
- q.pop();
- }
- if(r==p) cout<<"SI"<<endl;
- else cout<<"NO"<<endl;
- }
- #Si t'ha servit segueixme a insta @alexowlex
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement