您的位置:首页 > 其它

poj 2013 Symmetric Order

2012-03-29 14:34 274 查看
1. 简单题,故意用了栈,另外从这个题上可以体会到OJ判题模式

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

int main()
{
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
stack<string> st;
int i, j, n;
string str;
for (i = 1; ; i++)
{
cin >> n;
if (n == 0)
break;
cout << "SET " << i << endl;
for (j = 1; j <= n; j++)
{
cin >> str;
if (j % 2 == 1)
cout << str << endl;
else st.push(str);
}
while (!st.empty())
{
cout << st.top() << endl;
st.pop();
}
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: