1 solutions

  • -1
    @ 2025-8-9 11:49:15

    抄题解不关我事(

    不用栈的解法:

    #include <bits/stdc++.h>
    #define int long long
    using namespace std;
    
    signed main() {
    	vector<int> a;
    	int x;
    	while (cin >> x) {
    		if (x == 0)
    			break;
    		a.push_back(x);
    	}
    
    	reverse(a.begin(), a.end());
    
    	for (auto &i : a)
    		cout << i << " ";
    
    	return 0;
    }
    
    • 1

    Information

    ID
    5541
    Time
    1000ms
    Memory
    125MiB
    Difficulty
    1
    Tags
    # Submissions
    42
    Accepted
    31
    Uploaded By