文章

93

粉丝

57

获赞

302

访问

49.8k

头像
括号匹配2 题解:暴力
P1838 南京理工大学/暨南大学2023年机试题
发布于2025年3月23日 17:34
阅读数 392

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

int main()
{
    string str;
    while(cin>>str)
    {
        stack<char> s;
        int a=str.size();
        for(int i=0;i<a;i++)
        {
            if(str[i]=='>')
            {
                if(s.top()=='<')
                {
                    s.pop();
                }
                else
   &...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发