2014-11-29から1日間の記事一覧

10033 - Stacking Blocks II

#include <iostream> #include <stack> #include <string> using namespace std; void Slove(int n) { stack<string> st[n]; int p, p1, p2; string op, c; cin >> op; while (op != "quit") { if (op == "push") { cin >> p >> c; st[p-1].push(c); } else if (op == "pop") { cin >> p; cout </string></string></stack></iostream>…

10032 - Stacking Blocks I

#include <iostream> #include <stack> #include <string> using namespace std; void Slove(void) { stack<string> st; string op, word; cin >> op; while (op != "quit") { if (op == "push") { cin >> word; st.push(word); } else if (op == "pop") { cout << st.top() << endl; st.pop()</string></string></stack></iostream>…