1 条题解

  • 0
    @ 2025-12-3 10:40:07

    此题读入使用while,将读入的内容push进栈内,最后全部弹出输出即可。

    
    #include<bits/stdc++.h>
    
    using namespace std;
    
    stack<int> save;
    
    int main()
    {
    	int x;cin>>x;
    	while(x){
    		save.push(x);
    		cin>>x;
    	}
    	while(save.size()){
    		cout<<save.top()<<' ';
    		save.pop();
    	}
    	return 0;
    }
    
    
    • 1

    信息

    ID
    420
    时间
    1000ms
    内存
    125MiB
    难度
    1
    标签
    递交数
    111
    已通过
    44
    上传者