文章

246

粉丝

0

获赞

1182

访问

97.4k

头像
字符串的单词颠倒 题解:
P5271
发布于2026年3月29日 14:25
阅读数 247

#include<iostream>
#include<stack>
using namespace std;

string str;
stack<string> st;

int main()
{
    int n;
    cin>>n;
    while(cin>>str)
    st.push(str);
    while(!st.empty())
    {
        cout<<st.top()<<" ";
        st.pop();
    }
    return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发