标签:des style http color strong os
Description
Input
Output
Sample Input
5 2 1 3 a 2 a 3 r a 4 p 2 r a 5 r e
Sample Output
2 5
//数据集合之间有空行。 #include<iostream> #include<algorithm> using namespace std; int a[10000],i,b[10000],c,j,k,p,j1,mn,qq[100]; int n,m; char s; void shanchu() { n++; sort(a,a+k); if(p==1) { for(i=0;i<j1;i++) if(n==b[i]) {qq[mn]=a[0];mn++;break;} a[0]=999999; } else { for(i=k-1;i>=0;i--) if(a[i]!=999999) { m=a[i]; a[i]=999999; break; } for(i=0;i<j1;i++) if(n==b[i]) {qq[mn]=m;mn++;} } } int main() { while(cin>>n&&n) { mn=0; n=0; cin>>j1; j=0; i=j1; k=0; p=1; while(i--) cin>>b[i]; while(cin>>s) { if(s=='e') break; switch(s) { // case 'e':break; case 'a':cin>>a[k],k++;break; case 'r':shanchu();break; case 'p':cin>>p;break; } } for(i=0;i<j1;i++) cout<<qq[i]<<endl; } cout<<endl; return 0; }
J - MANAGER(2.4.5),布布扣,bubuko.com
标签:des style http color strong os
原文地址:http://blog.csdn.net/rememberautumn/article/details/37830211