我的日记之stl的stack的使用方式
2015-08-17 21:11
399 查看
#include<iostream> #include<algorithm> #include<cstring> #include<cstdio> #include<vector> #include<map> #include<cmath> #include<stack> #include<vector> using namespace std; stack<char>s; string ss; int main() { // int len=strlen(mapp); int i; bool flagf=false,flagj=false; cin>>ss; for(i=0;i<ss.size();i++) { s.push(ss[i]); if(ss[i]=='-') flagf=true; } char pre; flagj=true; if(flagf) {printf("-");flagj=true;} while(!s.empty()) { pre=s.top(); s.pop(); if(pre=='-') continue; else if(flagj==true&&pre=='0') continue; else if(flagj==true&&pre!='0') { printf("%c",pre); flagj=false; } else printf("%c",pre); } printf("\n"); return 0; }
相关文章推荐
- UVA 147- Dollars(dp之子集和问题)
- 杭电2680 Choose the best route
- cocos 绑定到lua时指定命名空间 程序崩溃
- POJ 2019 二维RMQ
- 【索引】Geometric Computations in 2D::Examples
- 高仿知乎日报(四)
- UI_model传值, json数据解析
- [BZOJ3211] 花神游历各国/[BZOJ3038] 上帝造题的七分钟2
- PHP:文件的上传下载
- hdu 1874 畅通工程续
- 求所有最大公共子序列的算法实现(转)
- 字符串的排列组合
- socket学习笔记——线程(聊天程序)
- Google之海量数据的交互式分析工具Dremel
- vv_jeffy之spring4.x集成myibatis3.x
- 231 Power of Two
- Android中onClick的四种实现方法
- POJ 3207 Ikki's Story IV - Panda's Trick(2 - sat啊)
- hdu 2066 一个人的旅行
- linux下jenkins安装