非个人题解,来自学长,仅是本人学习使用 不用栈也可以,先处理连乘,再处理加法。
 栈-程序员输入问题
 把字符串从前往后找,是#就退栈;是@就清空栈;其他的就直接入栈!
 然后把这个栈弄到另外一个栈里,输出就可以了!#include <bits/stdc++.h> using namespace std; stack<char>vis1,vis2; int main() { char a[105]; gets(a); int len=strlen(a); for(int i=0;i<len;i++) { if (a[i]=='@') { while(!vis1.empty())             vis1.pop(); continue; } if (a[i]=='#') {vis1.pop();continue;}       vis1.push(a[i]); } while(!vis1.empty()) {      vis2.push(vis1.top());       vis1.pop(); } while(!vis2.empty()) { char tmp=vis2.top();      cout<<tmp;      vis2.pop(); }  cout<<endl; return 0; }#include <bits/stdc++.h> using namespace std; struct sa { int v; double c; }; stack<sa>vis; int main() {  ios::sync_with_stdio(false);    string p; int v0,n,v1,v10,v20; double c0,c1,c10,c20;    cin>>v0>>c0;    v20=v0;    c20=c0;    cin>>n; for(int i=1;i<=n;i++) {        cin>>p; if (p=="P") {            cin>>v1>>c1;            vis.push({v1,c1});            c0=(v0*c0*0.01+v1*c1*0.01)/(v0+v1);            c0=c0*100.00;            v0=v0+v1; printf("%d %.5lfn",v0,c0); } else { if (vis.empty()) { printf("%d %.5lfn",v20,c20); continue; }             sa tmp=vis.top();            vis.pop();            v10=tmp.v;            c10=tmp.c;            c0=((v0*c0*0.01-v10*c10*0.01)/(v0-v10))*100.00;            v0=v0-v10; printf("%d %.5lfn",v0,c0); } } return 0; }#include <bits/stdc++.h> using namespace std; int n,p,a[110]; stack<int>s; int main() {     ios::sync_with_stdio(false);     cin>>n; for(int i=1;i<=n;i++)         cin>>a[i];//出栈的编号     p=1; for(int i=1;i<=n;i++) { if(i<=a[p]){s.push(i);printf("A");} if(i==a[p]) { while(!s.empty()&&s.top()==a[p]) {                 s.pop(); printf("B");                 p++; } if(p==n+1)break; } } printf("n"); return 0; }#include <iostream> #include <bits/stdc++.h> using namespace std; int main() {     stack<int>xpz;     stack<int>cpz;     stack<int>pz; int a,b,n,i;     cin>>n; for(i=n;i>=1;i--) {         xpz.push(i); } while(cin>>a>>b) { if(a==1) { for(i=1;i<=b;i++) {                 cpz.push(xpz.top());                 xpz.pop(); } } if(a==2) { for(i=1;i<=b;i++) {                 pz.push(cpz.top());                 cpz.pop(); } } if(pz.size()==n) break;//要判断一下,洗出来的盘子的个数与一开始输入的个数是否一样 } while(!pz.empty()) {         cout<<pz.top()<<endl;         pz.pop(); } return 0; }#include <bits/stdc++.h> using namespace std; string a; stack<char>s; int main() {     cin>>a; for(int i=0;i<a.length();i++) { if(s.empty()||a[i]=='('||a[i]=='['){s.push(a[i]);continue;} if(s.top()=='('&&a[i]==')')s.pop(); else if(s.top()=='['&&a[i]==']')s.pop(); else s.push(a[i]); } if(s.empty())printf("OKn"); else printf("Wrongn"); return 0; }#include using namespace std; int main() { long long int a,cl,cr,t; char tmp='a'; long long int re=0,all;     stack  a1; while(scanf("%lld",&a)!=-1) { if(a1.empty()) {             a1.push(a);             tmp=getchar(); } else { if(tmp=='*') {                 cl=a1.top();                 a1.pop();                 cr=a;                 a1.push((cl%10000)*(cr%10000)); } else {                 a1.push(a); }             tmp=getchar(); } } while(!a1.empty()) {         re=re+a1.top();         a1.pop(); } printf("%lldn",re%10000); }#include <bits/stdc++.h> using namespace std; const int mod=1e4; char c; int x,tmp,ans; int main() { scanf("%d",&x);tmp=x%mod; while(scanf("%c",&c)&&c!='n') { scanf("%d",&x);         x=x%mod; if(c=='*')tmp=tmp*x%mod; else {ans=ans+tmp%mod;tmp=x%mod;} }     ans=ans+tmp%mod; printf("%dn",ans%mod); return 0; }
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算
 官方软件产品操作指南 (170)
官方软件产品操作指南 (170)