hdu1237

/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>

typedef long long LL;
using namespace std;

double n;

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);

	while(scanf("%lf", &n) == 1){
		char c;
		c = getchar();
		stack<double>st;
		st.push(n);
		if(c == '\n' && n == 0){
			break;
		}
		c = getchar();
		while(scanf("%lf", &n) == 1){
			if(c == '*'){
				double u = st.top();
				st.pop();
				st.push(u * n);
			}else if(c == '/'){
				double u = st.top();
				st.pop();
				st.push(u / n);
			}else if(c == '-'){
				st.push(-n);
			}else{
				st.push(n);
			}
			if(getchar() == '\n') break;
			c = getchar();
		}
		double ans = 0;
		while(st.size()){
			ans += st.top();
			st.pop();
		}
		printf("%.2lf\n", ans);
	}

	return 0;
}
/**/

 

全部评论

相关推荐

LazyBreeze:项目尽量体现你对技术的理解和深度,不是说把中间件用一下就完事了,你项目里面提到集群和分布式,你真在服务器上部署过吗,感觉太假了,第二个项目说自己用了微服务的什么组件,只是用了没有自己的思考,很难让面试官注意到你的简历。针对某几个技术点自己多思考一下,考虑一下有没有别的替代方案,可以写一下,即使没有真的实现
点赞 评论 收藏
分享
求offer的大角牛:简历写的第一乱,没有突出重点,第二项目太多太杂看不出来有啥核心技术,第三自我评价太多了,第四获得的荣誉没啥含金量,可以不写,反正问题不少
点赞 评论 收藏
分享
07-16 14:10
门头沟学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务