日常刷题2019-01-09

#include <bits/stdc++.h>

using namespace std;

int main()
{
stackvis;
stackvis2;
char c;
while(~scanf("%c",&c))
{
while(c!=’\n’&&c!=’\0’)
{
if(c==’#’)
{
if(!vis.empty()) vis.pop();
}
else if(c==’@’) while(!vis.empty()) vis.pop();
else vis.push©;
c=getchar();
}
while(!vis.empty()) vis2.push(vis.top()),vis.pop();
while(!vis2.empty()) printf("%c",vis2.top()),vis2.pop();
cout<<endl;
}
return 0;
}

#include
#include
#include
#include

using namespace std;

int main()
{
stack s1;
stack s2;
char str[110];
gets(str);
int len=strlen(str);
for(int i=0; i<len; i++)
{
if(str[i]’@’)
{
while(!s1.empty()) s1.pop();
continue;
}
if(str[i]
’#’)
if(!s1.empty())
{
s1.pop();
continue;
}
s1.push(str[i]);
}
while(!s1.empty()) s2.push(s1.top()),s1.pop();
while(!s2.empty()) printf("%c",s2.top()),s2.pop();
printf("\n");
return 0;
}

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

char s[300];

int main()
{
scanf("%s",s);
int l=strlen(s);
stackq;
char tmp;
for(int i=0; i<l; i++)
{
if(q.empty()) q.push(s[i]);
else
{
tmp=q.top();
if((tmp==’[’&&s[i]’]’)||(tmp’(’&&s[i]==’)’)) q.pop();
else q.push(s[i]);
}
}
if(q.empty()) printf(“OK\n”);
else printf(“Wrong\n”);
return 0;
}

//#include <bits/stdc++.h>
//
//using namespace std;
//
//int main()
//{
// stackvis;
// stackvis2;
// char c;
// while(~scanf("%c",&c))
// {
// c1=1;
// while(c!=’\n’&&c!=’\0’)
// {
// while(!vis.empty()) vis2.push(vis.top()),vis.pop();
// while(!vis2.empty()) printf("%c",vis2.top()),vis2.pop();
// cout<<endl;
// }
// }
// return 0;
//}
//
//
//#include<bits/stdc++.h>
//
//using namespace std;
//
//typedef long long ll;
//
//char s[300];
//
//int main()
//{
// scanf("%s",s);
// int l=strlen(s);
// stackq;
// char tmp;
// for(int i=0; i<l; i++)
// {
// if(q.empty()) q.push(s[i]);
// else
// {
// tmp=q.top();
// if((tmp==’[’&&s[i]’]’)||(tmp’(’&&s[i]==’)’)) q.pop();
// else q.push(s[i]);
// }
// }
// if(q.empty()) printf(“OK\n”);
// else printf(“Wrong\n”);
// return 0;
//}
#include <bits/stdc++.h>

using namespace std;

int main()
{
stackvis;
stackvis2;
char c;
while(~scanf("%c",&c))
{

}
return 0;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值