当前位置: 代码迷 >> 综合 >> nyoj555相反输出
  详细解决方案

nyoj555相反输出

热度:95   发布时间:2023-11-01 07:21:46.0

用栈写的。

#include<bits/stdc++.h>
using namespace std;
int main()
{stack<int>a;int x=0;while((scanf("%d",&x)!=EOF))a.push(x);while(a.size()){if(a.size()!=1)cout<<a.top()<<' ';elsecout<<a.top()<<endl;a.pop();}}


  相关解决方案