【小米oj】 解救我 mi

堆栈的基本应用

 1 #define mm(a) memset(a,0,sizeof(a));
 2 #define max(x,y) (x)>(y)?(x):(y)
 3 #define min(x,y) (x)<(y)?(x):(y)
 4 #define Fopen freopen("1.in","r",stdin); freopen("m.out","w",stdout);
 5 #define rep(i,a,b) for(ll i=(a);i<=(b);i++)
 6 #define per(i,b,a) for(ll i=(b);i>=(a);i--)
 7 #include<bits/stdc++.h>
 8 typedef long long ll;
 9 #define PII pair<ll,ll>
10 using namespace std;
11 const int INF=0x3f3f3f3f;
12 const int MAXN=(int)2e6+5;
13 
14 char s[MAXN];
15 deque<char>q;
16 int main()
17 {
18     scanf("%s",s);
19     for(int i=0;s[i];i++){
20         if(s[i]==i&&!q.empty()&&q.back()==m)q.pop_back();
21         else q.push_back(s[i]);
22     }
23 //    for(auto i:q)printf("%c",i);
24     while(!q.empty())printf("%c",q.front()),q.pop_front();
25     return 0;
26 }

 

【小米oj】 解救我 mi

上一篇:Discrete Mathematics and Its Applications | 1 CHAPTER The Foundations: Logic and Proofs | 1.3 Propositional Equivalences


下一篇:【小米oj】 国王招驸马