#25199: C++三行解


nathanlee850 (Nathan850)


#include <bits/stdc++.h>

using namespace std;

int main()

{string s,c;int a,b;while(getline(cin,s)){stack<long long int> st;stringstream ss;ss<<s;while(ss>>c){if(c=="+"){a=st.top();st.pop();b=st.top();st.pop();st.push(a+b);}else if(c=="-"){a=st.top();st.pop();b=st.top();st.pop();st.push(b-a);}else if(c=="*"){a=st.top();st.pop();b=st.top();st.pop();st.push(a*b);}else if(c=="/"){a=st.top();st.pop();b=st.top(); st.pop();st.push(b/a);}else{st.push(stoi(c));}}cout<<st.top()<<"\n";}}

#25200: Re:C++三行解


agar.io6100@gmail.com (企鵝)


#include <bits/stdc++.h>

using namespace std;

int main()

{string s,c;int a,b;while(getline(cin,s)){stack st;stringstream ss;ss<<s;while(ss>>c){if(c=="+"){a=st.top();st.pop();b=st.top();st.pop();st.push(a+b);}else if(c=="-"){a=st.top();st.pop();b=st.top();st.pop();st.push(b-a);}else if(c=="*"){a=st.top();st.pop();b=st.top();st.pop();st.push(a*b);}else if(c=="/"){a=st.top();st.pop();b=st.top(); st.pop();st.push(b/a);}else{st.push(stoi(c));}}cout<<st.top()<<"\n";}}

三小東西

#25201: Re:C++三行解


nathanlee850 (Nathan850)


#include <bits/stdc++.h>

using namespace std;int main(){string s,c;int a,b;while(getline(cin,s)){stack<long long int> st;stringstream ss;ss<<s;while(ss>>c){if(c=="+"){a=st.top();st.pop();b=st.top();st.pop();st.push(a+b);}else if(c=="-"){a=st.top();st.pop();b=st.top();st.pop();st.push(b-a);}else if(c=="*"){a=st.top();st.pop();b=st.top();st.pop();st.push(a*b);}else if(c=="/"){a=st.top();st.pop();b=st.top(); st.pop();st.push(b/a);}else{st.push(stoi(c));}}cout<<st.top()<<"\n";}}



#25202: Re:C++三行解


martin0968872985@gmail.com (DISESFGEWU)


#include <bits/stdc++.h>

using namespace std;

int main()

{string s,c;int a,b;while(getline(cin,s)){stack st;stringstream ss;ss<<s;while(ss>>c){if(c=="+"){a=st.top();st.pop();b=st.top();st.pop();st.push(a+b);}else if(c=="-"){a=st.top();st.pop();b=st.top();st.pop();st.push(b-a);}else if(c=="*"){a=st.top();st.pop();b=st.top();st.pop();st.push(a*b);}else if(c=="/"){a=st.top();st.pop();b=st.top(); st.pop();st.push(b/a);}else{st.push(stoi(c));}}cout<<st.top()<<"\n";}}


那學弟你也很有特色ㄟ

#25593: Re:C++三行解


810416@fhsh.khc.edu.tw (Eric_hung)


#include <bits/stdc++.h>

using namespace std;

int main()

{string s,c;int a,b;while(getline(cin,s)){stack st;stringstream ss;ss<<s;while(ss>>c){if(c=="+"){a=st.top();st.pop();b=st.top();st.pop();st.push(a+b);}else if(c=="-"){a=st.top();st.pop();b=st.top();st.pop();st.push(b-a);}else if(c=="*"){a=st.top();st.pop();b=st.top();st.pop();st.push(a*b);}else if(c=="/"){a=st.top();st.pop();b=st.top(); st.pop();st.push(b/a);}else{st.push(stoi(c));}}cout<<st.top()<<"\n";}}

 

 

笑死

#33247: Re: C++三行解


leo950518test (耶嘿一灘爛泥)


#include

using namespace std;

int main()

{string s,c;int a,b;while(getline(cin,s)){stack st;stringstream ss;ss<>c){if(c=="+"){a=st.top();st.pop();b=st.top();st.pop();st.push(a+b);}else if(c=="-"){a=st.top();st.pop();b=st.top();st.pop();st.push(b-a);}else if(c=="*"){a=st.top();st.pop();b=st.top();st.pop();st.push(a*b);}else if(c=="/"){a=st.top();st.pop();b=st.top(); st.pop();st.push(b/a);}else{st.push(stoi(c));}}cout<

這尛...

那我還可以一行解