首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
esmond564
2026年3月11日 22:34
计算表达式 题解:简单模拟
P1281
回复 0
|
赞 1
|
浏览 31
#include<bits/stdc++.h> using namespace std; int main() { string s; while(cin>>s) { vector<int> nums; //存需要加的数,乘除先算出来,减法当成负号,题目情况比较简单,没有括号说明没有负数  ...
mlx
2026年3月9日 10:42
计算表达式 题解:
P1281
回复 0
|
赞 3
|
浏览 69
#include<iostream> #include<stack> #include<map> using namespace std; string str; map<char,int> m={{'+',1},{'-',1},{'*',2},{'/',2}}; int work() { stack<char> s; stack<int> num; string n=""; for(int i=0;i<str.size();i++) ...
cow
2026年3月6日 11:13
计算表达式 题解:
P1281
回复 0
|
赞 2
|
浏览 70
纯C语言 #include <stdio.h> #include <ctype.h> //运算符优先级 int priority(char ch){ if(ch=='+'||ch=='-') return 1; if(ch=='*'||ch=='/') return 2; return 0; } //计算 int calculate(int ...
liux662
2026年2月14日 22:09
计算表达式 题解:
P1281
回复 0
|
赞 6
|
浏览 226
#include<bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); string s; while(cin >> s) { vector<char> op; //建立一个操作符的数组 vector<int> nums; //记录运算数组 int num = 0; for(int i = 0; i < s.size(); i ++) { if(s...
18919717626
2026年2月12日 17:41
计算表达式 题解:
P1281
回复 0
|
赞 3
|
浏览 182
双zai的思路,感觉挺繁琐 #include<bits/stdc++.h> using namespace std; int priority(char a){ if(a=='+'||a=='-') return 1; if(a=='/'||a=='*') return 2; else return 0; } int main(){ string s;  ...
fff8e73
2025年7月8日 22:36
计算表达式 题解:
P1281
回复 0
|
赞 6
|
浏览 678
#include <bits/stdc++.h> using namespace std; struct op{ char ch; int pri; }; int ans[100]; int flag[100]{0}; int cnt=0; void getOp(char ch){//将当前运算符放入ans flag[cnt]=1;//运算符 if(ch=='+') ans[cnt]=1; else if(ch=='-') ans[cnt]=2; else if(ch=='*') ans[cnt]=3; else if(ch=='...
zxjrheaven
2025年3月23日 22:02
计算表达式 题解:非本人编写,但解法很好,值得分享
P1281
回复 0
|
赞 22
|
浏览 1.2k
#include<bits/stdc++.h> using namespace std; int main(){ double t; double a[1000]; while(scanf("%lf",&t)!=EOF){ double sum=0; char ch;int i=0;a[0]=t; ...
上头内啡肽
2025年3月23日 10:03
计算表达式 题解:
P1281
回复 0
|
赞 5
|
浏览 897
#include <iostream> #include <cstring> #include <algorithm> #include<stack> #include<unordered_map> #define debug(a) cout<<#a<<"="<<a<<endl; using namespace std; unordered_map<char,int> mp; int cal(int a,int b...
上头内啡肽
2025年3月23日 10:03
计算表达式 题解:
P1281
回复 0
|
赞 1
|
浏览 944
#include <iostream> #include <cstring> #include <algorithm> #include<stack> #include<unordered_map> #define debug(a) cout<<#a<<"="<<a<<endl; using namespace std; unordered_map<char,int> mp; int cal(int a,int b...
riddle
2025年3月23日 09:53
计算表达式 题解:
P1281
回复 0
|
赞 5
|
浏览 1.0k
比较好理解的,代码有些冗余,但思路比较清晰 #include <iostream> #include <stack> #include <map> #include <cctype> using namespace std; int main() { // 运算符优先级映射:'/' 和 '*' 优先级为 1,'+' 和 '-' 优先级为 0 map<char, int> mp; mp['/'] = 1; mp['*'] = 1; mp['+'] = 0;...
1
2
题目
计算表达式
题解数量
19
发布题解
在线答疑
热门题解
1
用 操作数栈+运算符栈 解决中缀表达式计算问题
2
计算表达式 题解:非本人编写,但解法很好,值得分享
3
计算表达式 题解:stack求值
4
计算表达式 题解:用栈中缀表达式求值,附卡40%原因解答
5
P1281 计算表达式 答疑提问:
6
计算表达式 先构造出后缀表达式,再计算后缀表达式
7
计算表达式 题解:
8
计算表达式 题解:
9
计算表达式 题解:代码来了哦
10
计算表达式 题解: