有没有大佬康康为什么只过了45啊 #include <iostream> (5488)#include <stack> using namespace std; int main() { int t; int jud = 1; cin >> t; while (t--) { stack<string>s; int n; jud = 1; string temp,temp2; cin >> n; for (int i = 0; i < n; i++) { cin >> temp; if (temp != "end") { s.push(temp); } else if(temp=="end") { cin >> temp2; if (!s.empty()&;&;temp2 == s.top()) { s.pop(); } else { jud = 0; break; } } } if (jud == 1&;&;s.empty()) { cout << "Yes"<<endl; } else { cout << "No"<< endl; } } return 0; }
点赞 3

相关推荐

头顶尖尖的程序员:我也是面了三四次才放平心态的。准备好自我介绍,不一定要背熟,可以记事本写下来读。全程控制语速,所有问题都先思考几秒,不要急着答,不要打断面试官说话。
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务