bzoj 3403: [Usaco2009 Open]Cow Line 直线上的牛 暴力

来源:互联网 发布:mysql eq ref 编辑:程序博客网 时间:2024/04/27 23:41

→题目链接←

非常非常的水

为了方便+奇懒无比而用了deque

真的非常的方便


代码:

#include<cstdio>#include<deque>using namespace std;deque<int>v;int n;char c;int x,num=1;int main(){scanf("%d\n",&n);for(int i=1; i<=n; i++){c=getchar();getchar();if(c=='A'){c=getchar();if(c=='L')v.push_front(num);else v.push_back(num);num++;}else{c=getchar();scanf("%d",&x);if(c=='L')while(x--)v.pop_front();else while(x--)v.pop_back();}getchar();}for(int i=0; i<v.size(); i++){printf("%d\n",v[i]);}return 0;}


阅读全文
0 0
原创粉丝点击