有没有大佬康康为什么只过了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

相关推荐

强大的马里奥:不太可能,我校计算机硕士就业率99%
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务