2 条题解

  • 0
    @ 2026-8-27 17:01:16

    使用STL自带的 即可

    AC code:

    #include <bits/stdc++.h>
    using namespace std;
    stack <int>st;
    
    
    int main() {
    	int n;
    	cin>>n;
    	while(n--){
    		int x;
    		cin>>x;
    		st.push(x);
    	}
    	while(!st.empty()){
    		cout<<st.top()<<' ';
    		st.pop();
    	}
    
    
    	return 0;
    }
    
    • 0
      @ 2026-6-11 21:26:27

      #include <bits/stdc++.h> using namespace std;

      int main() { int a[100], n; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int j = n; j > 0; j--) { cout << a[j] << " "; } return 0; }

      • 1

      信息

      ID
      30013
      时间
      1000ms
      内存
      256MiB
      难度
      1
      标签
      递交数
      70
      已通过
      49
      上传者