摘要: #include<iostream>#include<string>#include<stack>using namespace std;int main(){ int n; cin>>n; cin.ignore(); while(n--) { string temp; getline(cin,temp); if(temp=="") { cout<<"Yes"<<endl; } else { stack<char> s; ... 阅读全文
posted @ 2012-05-03 23:14 open your eyes 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 乌龟王国的乌龟总是一只一只叠在一起。唯一改变乌龟位置的方法为:一只乌龟爬出他原来的位置,然后往上爬到最上方。给你一堆乌龟原来排列的顺序,以 及我们想要的乌龟的排列顺序,你的任务是按照先后次序列出出哪只乌龟需往上爬,使得可以产生所要的乌龟排列顺序,且爬的动作要发生最少。Input输入的第一列有一个整数,代表以下有多少组测试资料。每组测试资料的第一列有1个整数 n (n<=200),代表乌龟的数目。接下来的 n 列每列有一只乌龟的名字(乌龟名字均为唯一,且仅包含字符、空白、句点,长度不会超过80个字符),代表原来乌龟排列的顺序(由上到下)。再接下来的 n 列每列也有一只乌龟的名字,代表我们想 阅读全文
posted @ 2012-05-03 21:22 open your eyes 阅读(220) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<cstdio>#include<malloc.h>#include<cstdlib>using namespace std;typedef struct cicle{ int data; struct cicle *next; struct cicle *prior;}list;list *createcyclelist(int n){ list *head=NULL; list *s,*q; s=(list*)malloc(sizeof(list)); head=s; q=s; h... 阅读全文
posted @ 2012-05-03 01:17 open your eyes 阅读(358) 评论(0) 推荐(0) 编辑